Js正则表达式数字或者带小数点的数字

   function chk() {
            var patrn = /^\d+(\.\d+)?$/;
            var result = true;
            $("input[type=text]").each(function () {
                if (!patrn.exec(this.value)) {
                    alert("请输入正确的数字!");
                    result = false;
                }
            })

            return result;
        }

 

posted @ 2017-03-17 17:31  WangJunZzz  阅读(60058)  评论(0编辑  收藏  举报