How to exclude Id from focusout

前端 未结 2 806
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-23 03:16

With Jquery, focusout is just called when you click anywhere out of the focused area when \"focusout\" is set.

How do I exclude some id(s) from activiting the \"focusou

2条回答
  •  醉梦人生
    2021-01-23 04:00

    Try using relatedTarget event property:

    $('#id').focusout (function (e) {
    
        if (e.relatedTarget && e.relatedTarget.id === 'dontFocusOut') {
            return;
        }
        //do your thing
    
    });
    

提交回复
热议问题