Just a note of jQuery fragment.

// cancel the default event action for input and move to the next element
jQuery('input').keydown(function(e){
    if (e.keyCode == 13 && (e.target.type == 'text' || e.target.type == 'password')){
        var elements = jQuery(this).parents('form').get(0).elements;
        var i = 0;
        for (; i < elements.length; i++) {
            if (elements[i] == e.target){
                break;
            }
       }
       e.preventDefault();//this is what doing the trick...
       jQuery(elements[i + 1]).focus();
   }
});
Tagged with:
 

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>