Consider the following form:
<form action="/a" method="post"> <input name="x" type="text" onblur="myonblur(e)" /> <input name="y" type="text" /> <input name="submit" type="submit" value="Submit" /> </form>
When focus is on element with name "x" and user presses submit button, onblur event fires but form is NOT submitted. Is there any way to make submit button work as expected if I have onblur events in my form?
Consider optimizing your
onBlur()method so it takes less time to run. If your form is prevented from getting submitted, it might be because theonBlur()is too long and hangs the browser from doing anything else.You can also use the
onChange()method instead ofonBlur(). That may work better for you.