jQuery - Dynamically Create Button and Attach Event Handler

前端 未结 5 1079

I would like to dynamically add a button control to a table using jQuery and attach a click event handler. I tried the following, without success:

$(\"#myBut         


        
5条回答
  •  Happy的楠姐
    2020-12-13 12:57

    You were just adding the html string. Not the element you created with a click event listener.

    Try This:

    
    
        
    
    
        
    Row 1
    Row 2

提交回复
热议问题