gpt4 book ai didi

javascript - 在 sweetAlert 中输入文本

转载 作者:数据小太阳 更新时间:2023-10-29 04:22:27 26 4
gpt4 key购买 nike

我正在使用 sweetalert 的自定义版本向我的用户询问 input。我已经设法使一切正常,但有一个奇怪的行为,为了能够在输入框中输入文本,您必须先点击屏幕:

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");
});

工作示例:https://jsfiddle.net/fvkppx06/

最佳答案

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 === null) return false;

if (inputValue === "") {
swal.showInputError("You need to write something!");
return false
}

swal("Nice!", "You wrote: " + inputValue, "success");
});

关于javascript - 在 sweetAlert 中输入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29920784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com