[pre]<form action="#" onsubmit="alert('test');">
<input name="foo" type="text" onkeypress="if(event.keyCode==13){form.submit();}" />
<input type="submit" value="Submit" />
</form>[/pre]
This submits the form when a user presses the 'Enter' key in the text box, but it won't call the test message before it continues. Any ideas why?
As always, it works in FF.
I know I could place the 'test' message in the input's keypress event, but I'm curious if there's an explanation or a better way to call the onsubmit.
Thank you,
vol7ron