因此,我正在构建一个最小值为' 5‘(整型)的表单,如果该值小于5,则使用onblur检查该值。
但是当我用onblur="functionName()"触发函数时,当输入正确时,它不会自动重置。(所以输入大于5)。
let minimalAmount = 5;
let inputAmount = document.getElementById('amountInput');
function checkAmount()
{
if (inputAmount.value < minimalAmount)
{
$('#amountAlert').html('Alert!');
}
} 这就是我到目前为止所尝试的。有什么建议吗?
发布于 2020-12-22 22:03:56
多亏了Swati,我明白了:
function checkAmount()
{
$('#amountAlert').html("");
if (inputAmount.value < minimalAmount)
{
$('#amountAlert').html('Alert!');
}
}https://stackoverflow.com/questions/65409930
复制相似问题