diff --git a/src/js/alertify.js b/src/js/alertify.js index 073e8706..12a7f0f4 100644 --- a/src/js/alertify.js +++ b/src/js/alertify.js @@ -55,6 +55,7 @@ cancel: "" }, input: "", + select: "", + select: "'; + html += select; + } + html = (html + this.dialogs.buttons.holder + "" + "") .replace("{{buttons}}", btnTxt) .replace("{{ok}}", this.okLabel) @@ -141,12 +158,13 @@ * * @return {Object} */ - dialog: function(message, type, onOkay, onCancel) { + dialog: function(message, type, onOkay, onCancel, selectOptions) { return this.setup({ type: type, message: message, onOkay: onOkay, - onCancel: onCancel + onCancel: onCancel, + selectOptions: selectOptions }); }, @@ -247,7 +265,7 @@ var btnOK = el.querySelector(".ok"); var btnCancel = el.querySelector(".cancel"); - var input = el.querySelector("input"); + var input = el.querySelector("input,select"); var label = el.querySelector("label"); // Set default value/placeholder of input @@ -333,7 +351,7 @@ this.parent.appendChild(el); setTimeout(function() { el.classList.remove("hide"); - if(input && item.type && item.type === "prompt") { + if(input && item.type && (item.type === "prompt" || item.type === "password")) { input.select(); input.focus(); } else { @@ -372,6 +390,7 @@ this.dialogs.buttons.ok = ""; this.dialogs.buttons.cancel = ""; this.dialogs.input = ""; + this.dialogs.select = "