How to determine if child was clicked in Jquery

后端 未结 6 879
广开言路
广开言路 2021-02-07 07:33

Is there a ways in jQuery to tell which child was clicked if the onclick event was binded to the parent?

For instance:

  $(\'#daddy\').click(function ()          


        
6条回答
  •  灰色年华
    2021-02-07 07:52

    The event handler you pass to click will receive an event object as its first argument. The target of the event (i.e. the element that initiated the event) will be specified there.

    Here's an example from the jQuery documentation:

    
    
    
      
      
    
    
    
    

    click

提交回复
热议问题