//文本框只能是数值
$("#DepartmentID").keyup(function() {
var tmptxt = $(this).val();
$(this).val(tmptxt.replace(/\D|/g, ''));
}).bind("paste", function() {
var tmptxt = $(this).val();
$(this).val(tmptxt.replace(/\D|/g, ''));
}).css("ime-mode", "disabled");
//文本框只能是数值并且首字符不能为0
$("#tel").keyup(function() {
var tmptxt = $(this).val();
$(this).val(tmptxt.replace(/\D|^0/g, ''));
}).bind("paste", function() {
var tmptxt = $(this).val();
$(this).val(tmptxt.replace(/\D|^0/g, ''));
}).css("ime-mode", "disabled");
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26481450/viewspace-739211/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26481450/viewspace-739211/