我正在使用自定义版本的
sweetalert来询问我的用户输入.我已经设法使一切工作,但有一个奇怪的行为,为了能够在输入框中输入文本,你必须先点击屏幕:
swal({ title: "Aggiornamento profilo",text: '<br /><form method="post" id="taxcode-update" name="taxcodeUpdate"><input id="admin-tax-code" minlength="3" class="form-control wedding-input-text wizard-input-pad" type="text" name="taxCode" placeholder="Codice fiscale"></form>',type: "warning",showCancelButton: false,confirmButtonText: "Aggiorna il mio profilo",cloSEOnConfirm: false },function () { swal("Deleted!","Your imaginary file has been deleted.","success"); });
解决方法
swal({ title: "An input!",text: "Write something interesting:",type: "input",showCancelButton: true,cloSEOnConfirm: false,animation: "slide-from-top",inputPlaceholder: "Write something" },function(inputValue){ if (inputValue === false) return false; if (inputValue === "") { swal.showInputError("You need to write something!"); return false } swal("Nice!","You wrote: " + inputValue,"success"); });