开发者

How to know where the input/element goes to after the blur event? [duplicate]

This question already has answers here: When a 'blur' event occurs, how can I find out which element focus went *to*? (23 answers) Closed 9 years ago.

I tr开发者_如何学Pythonied this, but it is undefined:

alert($(ev.relatedTarget).attr('name'));

I have a combobox (textbox and a button), I don't want the code to continue processing if the input goes to its partner control(button). I want to detect from textbox blur that it is leaving the whole combobox not just the textbox. Textbox's blur will naturally trigger when I click its partner button. The only ideal logic I can think of is to detect from textbox's blur that the focus destination is not its partner button, if the relatedTarget is its partner button don't continue processing.


If I understand your question correctly, I'd suggest adding a delayed function on the blur event of the textbox to check if the button is focused or not

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜