`
piperzero
  • 浏览: 3472335 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

火狐不支持event.keyCode,用jquery中的event.which轻松解决。

阅读更多
	$(':text[name="price"]').keypress(function(e) {
		if (e.which == 46
				|| ((e.which >= 48 && e.which <= 57)|| e.which == 8||e.which==0)) {
			return true;
		} else {
			alert("只可以输入数字哦!");
			$('#go').attr('disabled','disabled');
			return false;
		}
	});//0代表选择了esc
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics