/** * Created by wxf on 2017/3/15. */ $(document).ready(function () { }); //<button οnclick="alertTwoInput('测试描述','标题','请输入name','请输入pass','取消','确定');">测试</button> function alertTwoInput(text, title, input1, input2, onCancel, onOK) { var config; if (typeof text === 'object') { config = text; } else { config = { text: text, title: title, input1: input1, input2: input2, onOK: onOK, onCancel: onCancel, empty: false //allow empty }; } $.modal({ text: '<p class="weui-prompt-text">' + (config.text || '') + '</p><input type="text" class="weui-input weui-prompt-input" id="weui-prompt-input" value="' + (config.input1 || '') + '" />' + '<input type="text" class="weui-input weui-prompt-input" id="weui-prompt-input" value="' + (config.input2 || '') + '" />', title: title, buttons: [{ text: onCancel, className: "primary", onClick: function () { console.log("cancel"); $.closeModal(); } } , { text: onOK, className: "primary", onClick: function () { console.log("ok"); } } ] }); }