Delete dynamically-generated table row using jQuery

前端 未结 6 2046
情深已故
情深已故 2020-12-31 02:28

the code below add and remove table row with the help of Jquery the add function works fine but the remove only work if I remove the first row

         


        
6条回答
  •  甜味超标
    2020-12-31 02:56

    I know this is old but I've used a function similar to this...

    deleteRow: function (ctrl) {
    
        //remove the row from the table
        $(ctrl).closest('tr').remove();
    
    }
    

    ... with markup like this ...

    
    X
     blah blah 
    
    

    ...and it works fine

提交回复
热议问题