Example code: http://jsfiddle.net/slolife/PnmxM/
I am asking this even though there are a number of similar questions, but I feel that they are not the same.
I have an textbox that when it is blurred, should do something.
I also have a link, that is always visible (that appears to be how the other questions differ) and when clicked, should do something.
My blur handler fires, but the click handler does not.
Is there a proper way to deal with this?
Update
Many people pointed out that the alerts were causing my problem. Thank you. In my real code, I do not have alerts, but instead remove the textbox from the DOM.
So I have updated the fiddle to better reflect that with console.log calls instead of alert() calls. Any additional help is appreciated.
This is because of the first
alertbreaking the secondalertbecause it’s modal. See this:Here, I’m appending the message to
msgsdiv and it works as expected.For your updated jsFiddle, here’s an (updated-updated?) working one:
You are removing the input box in your
onBlurand, as a consequence of that, moving theAdd itemvertically, thus the click doesn’t happen onAdd itemanymore (as your mouse pointer did not move in the meantime), but on some other element (in this case, a jsFiddle example container). MovingAdd itemabove the disappearinginputelement solves the “click me if you can” issue.