[wd_asp elements=’search’ ratio=’100%’ id=1]

Press Enter on textbox to go to next field, not tab

24th May 2015

Jquery - Strings

jquery icon



and another really easy one
jQuery.fn.tabEnter = function() {
this.keypress(function(e){
// get key pressed (charCode from Mozilla/Firefox and Opera / keyCode in IE)
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;

if(key == 13) {
// get tabindex from which element keypressed
var ntabindex = parseInt($(this).attr("tabindex")) + 1;
$("[tabindex=" + ntabindex + "]").focus();
return false;
}
});
}
$("[tabindex]").tabEnter();

Just change the “tabindex” value on each input text box to be incremental.