JS中使用isNaN()判断layer.prompt输入的值为数值型,代码如下:

layer.prompt({
    title: '设置比值',
}, function(value, index, elem){
    alert(value); //得到value
    if (isNaN(value)) {
        alert("请输入数字!");
        return;
    } else {
        alert("输入的是数字!");
    }
    layer.close(index);
});

 

相关文章:

  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-10-08
  • 2021-10-12
猜你喜欢
  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2021-12-24
  • 2021-08-10
  • 2022-12-23
  • 2021-11-18
相关资源
相似解决方案