Image input onclick event being fired when enter button Pressed
Posted
by Anthony
on Stack Overflow
See other posts from Stack Overflow
or by Anthony
Published on 2010-03-24T05:24:30Z
Indexed on
2010/03/24
5:33 UTC
Read the original article
Hit count: 214
I have a strange problem where an onclick event on an input image is being fired when i hit enter in input text box
<form id="MyForm" action="/someaction">
<input type="image" src="someimage.jpg" onclick="doStuff();$('#MyForm').submit();" />
<input type="text" name="textInput"/>
</form>
When the cursor is in the text box and i hit enter, rather than the form being submitted it calls the onclick event on the image input.
Any ideas whats going on ?
© Stack Overflow or respective owner