In web browsers, what's the difference between onblur and onfocusout?

前端 未结 5 1517
一向
一向 2020-12-02 21:59

If they\'re the same, then why there are two of this kind of event?

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 22:20

    The Jquery documentation has a good focusout vs. blur demo which I'll reproduce below for clarity. In short, focusout fires if the selector — $('p') in the demo — is anything including the inputs and parent elements. Whereas, blur only fires if the selector is on the inputs — $('input').

    
    
    
      
      focusout demo
      
      
    
    
    
    


    focusout fire
    blur fire

提交回复
热议问题