Assigning click event to dynamically added buttons

后端 未结 5 1837
孤街浪徒
孤街浪徒 2020-12-29 17:13

I am creating some buttons dynamically and assigning them IDs.

When ever someone clicks that button I want to collect the ID and from there perform some task.

5条回答
  •  孤独总比滥情好
    2020-12-29 17:38

    Just add a class name of new-button to the buttons you're creating and add a click handler afterwards.

    So replace this code

    
                    
                    0
                  
                       
                    
                   讨论(0)
                  
                                                      
                  
                  
提交回复
热议问题