jQuery - How do I bind events to hidden elements that will be shown later?

后端 未结 6 1168
花落未央
花落未央 2020-12-08 00:15

I am trying to attach \'click\' events to all elements of a particular class. The problem is some of the elements are on a tab that is hidden (display: none) at the time tha

6条回答
  •  青春惊慌失措
    2020-12-08 00:53

    According to the jquery documentation at http://api.jquery.com/live/

    Attach a handler to the event for all elements which match the current selector, now and in the future

    Here is an example of how to use it:

     
     
     
       
       
     
     
      

    Click me!

提交回复
热议问题