禁止回车键提交form表单

$(document).ready(function(){
  $("input[@type='text']").each(
       function(){
	        $(this).keypress( function(e) {
	                var key = window.event ? e.keyCode : e.which;
	                if(key.toString() == "13"){
	                	alert('Please click respective submit button as Enter key is disabled');
	                    return false;
	                }
	        });
    });
 }) 

 

 

禁止回车键提交form表单,兼容 ie,firefox,safari

你可能感兴趣的:(js,IE,firefox,Safari)