How can I clone a row in a table without cloning the values of the input elements inside it?

后端 未结 3 1772
猫巷女王i
猫巷女王i 2021-01-13 10:46

I am trying to add a row to a table. I found that we can use the clone() method to duplicate an existing row. My table has two text inputs in it in two different <

3条回答
  •  旧巷少年郎
    2021-01-13 11:15

    You can add this line after your given line to set the values of the input fields to blank:

    $('#table-1 tr:last input').attr('value','');
    

    or just:

    $('#table-1 tr:last input').val('');
    

提交回复
热议问题