在简单的javascript代码中,提示框的输入正常工作
f = prompt ("write a number here")
r = 1;
x = f-r;
alert(x);
在设置带有sweetalert的提示框样式时,在写入输入值之前结果将为NaN
f = 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");
});
r = 1;
x = f-r;
alert(x);