jQuery

Press Enter key focus on the next text box

Just Use this code in your custom js file:

jQuery(function() {</p>
	jQuery(‘input:text:first’).focus(); 
	var inp = jQuery(‘input:text’); 
	inp.bind(‘keydown’, function(e) { 
		//var key = (e.keyCode ? e.keyCode : e.charCode); 
		var key = e.which; 
		if (key == 13) { 
			e.preventDefault(); 
			var nxtIdx = inp.index(this) + 1; 
			jQuery(“:input:text:eq(” + nxtIdx + “)”).focus(); 
		} 
	}); 
}); 

Leave a Reply

Your email address will not be published. Required fields are marked *