jQuery, Only Trigger "Click" after "Blur" Has Fully executed
I have an input element with a blur event, and a link element with a click event. The p开发者_如何学Goroblem I am running into is when someone clicks on the link element (the click), focus is taken off of the input element (the blur), but the simultaneous events cause the blur event to not fully execute.
What is the best way for making sure the blur event fully executes prior to firing the click event?
This isn't the best way of handling it, but it should work... you can try putting a short delay()
on the click()
event.
My other thoughts are that you could try calling your click()
handler from the callback of the blur()
, but I'd have to tinker around with that to see how that'd work in practice.
You could hook into the click event on the link and call input.blur() inside that event handler.
On 2nd thought, if the blur doesn't execute because the link click loads a new page, then you probably need to hook into unload or beforeunload events
精彩评论