I\'m trying to make it so when a user is in a text box and they press enter, it is the same as clicking the link, in which case it should take them to another page. Here\'s what
Write a small jQuery plugin:
jQuery.fn.enter = function(callback) { if(!callback) { //don't attach if we have garbage. return; } $(this).keydown(function(e) { var ev = e || event; if(ev.keyCode == 13) { callback(); return false; } }); };
Usage: $(element).enter(callback_func);
$(element).enter(callback_func);
I hope this helps.