I have a text input and a link used as a button set up on my website like so:
<input type="text" onblur="blurfunction()">
<a href="javascript:buttonfunction()">Button</a>
It’s important for my functionality to have blurfunction()
always fire before buttonfunction()
, even if the link is clicked directly without exiting the text field. From my limited testing in latest Chrome and Firefox clicking on the link directly from the text field consistently deselects the text field and fires blurfunction()
before handling the link click and firing buttonfunction()
.
Can I expect this behaviour to be consistent across all browsers/devices? Is the order these calls happen defined in the HTML/JavaScript spec or could implementations differ between browsers?