Blur event stops click event from working?

后端 未结 6 826
野的像风
野的像风 2020-12-02 16:49

It appears that the Blur event stops the click event handler from working? I have a combo box where the options only appear when the text field has focus. Choosing an option

6条回答
  •  日久生厌
    2020-12-02 17:17

    click event triggers after the blur so the link gets hidden. Instead of click use mousedown it will work.

    $('.ShippingGroupLinkList').live("mousedown", function(e) {
        alert('You wont see me if your cursor was in the text box');
    });
    

    Other alternative is to have some delay before you hide the links on blur event. Its upto you which approach to go for.

    Demo

提交回复
热议问题