标签:pre == else als skin layer ons [] blog
//juqery 判断所有input 不能为空
var $kong = $(".kong"); $kong.each(function(i){ if($(this).val() == ""){ layer.open({ content: "aaa" //判断哪个值没填写 ,skin: ‘msg‘ ,time: 3 //3秒后自动关闭 }); return false; } });
//判断手机号正确格式 if(!(/^1[3-8]{1}\d{9}$/.test(tel))){ layer.open({ content: "请输入正确格式的手机号" //判断哪个值没填写 ,skin: ‘msg‘ ,time: 3 //3秒后自动关闭 }); return false; }
html
<span><input type="text" placeholder="缴费金额..." name="pay[]" value="" class="name kong score"></span> juqery var isNum = true; $(function(){ $(‘input.score‘).change(function(){ checkScore(); }); }) var checkScore = function(){ $.each($(‘input.score‘),function(index,ele){ var curVal = $(ele).val(); if(isNaN(curVal)){ isNum = false; return false; }else{ isNum = true; } }) //console.log(isNum); } if(!isNum){ layer.open({ content: ‘缴费金额只能是数字!‘ //判断哪个值没填写 ,skin: ‘msg‘ ,time: 1 //3秒后自动关闭 }); }
标签:pre == else als skin layer ons [] blog
原文地址:http://www.cnblogs.com/zc290987034/p/7614635.html