html文本框只允许输入数值类型

2024-10-12 05:46:02

1、下载我提供的JQuery文件,可复制html示例运行

2、启主要作用的代码$('#money').each(function() {$(this).onlypressNumber();//只允许输入数值类型//$(this).onlypressInteger();//只允许输入整数//$(this).onlypressPositiveInteger();//只允许输入正整数});

3、<!doctype html><html><head><m髫潋啜缅eta charset="UTF-8"><title>html文本框只允许输入数值</title><script src='jquery-1.7.min.js'></script><script src='jquery.validate.maximin.js'></script></head><body>金额:<input type='text' id='money' /></body><script>$('#money').each(function() {$(this).onlypressNumber();//只允许输入数值类型//$(this).onlypressInteger();//只允许输入整数//$(this).onlypressPositiveInteger();//只允许输入正整数});</script></html>

猜你喜欢