I have a textbox which has the code;
Now there is no e
in jQuery
//Press Enter in INPUT moves cursor to next INPUT
$('#form').find(':input').keypress(function(e){
if ( e.which == 13 )
{
$(this).next().focus(); //Use whatever selector necessary to focus the 'next' input
}
});
<script language="JavaScript">
function disableEnterKey(e)
{
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
if(key == 13)
return false;
else
return true;
}
</script>
and write
<input type=”text” name=”mytext” onKeyPress=”return disableEnterKey(event)”>
use event.preventDefault()
or return False should do the trick for you.
Just to be sure, terminate your callback function with a return false
.
That should do the trick.
function(e) {
e.preventDefault();
// some awesome code
return false;
}
Oh, and another thing: in the future, to avoid such random behavior.. respect the standards, use a form
:)