Hi all,
How can I delete a row from a table which it has been created with a delete button before?
I need to add an event to btnDeleteOther to delete the current row selected. I would also need to know how to change id for each textbox created, and populate the value of the textbox with the variable coming to the function(but I guess I would have to ask that in other question).
Thanks.
Code example.
<html>
<head>
<script type="text/javascript">
function createNewRow (text1,text2){
$(document).ready(function(){
$('#tblOtherParties > tbody').append('<tr><td>
<input type="text" id="title1" value=""/>
</td><td>
<input type="text" id="title2"/>
</td><td>
<input type="button" id="btnDeleteOther" value="X"/>
</td></tr>');
});
}
</script>
</head>
<body>
<table style="float:left" id="tblOtherParties">
<thead>
<tr>
<th>Title1</th>
<th>Title2</th>
<th>
<input type="button" id="btnAddOther" title="Add" value="Add" onclick="javascript:createNewRow();"/>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="text" id="title1"/>
</td>
<td>
<input type="text" id="title2"/>
</td>
<td>
<input type="button" id="btnDeleteOther" value="X"/>
</td>
</tr>
</tbody>
</table>
</body>
</html>