Thursday, 18 December 2014

Jquery:: add table row, remove table row

<script type=”text/javascript”>
function addRowTable()
{
$(“#myTable > tbody”).append(“<tr><td>row content</td></tr>”);
}
function removeRowTable(rowId)
{
if(confirm(“Are you sure to delete this item?”)){
$(“#”+rowId).remove();
}
}
</script>
<table id=”myTable”>
<thead><th>head1</th></thead>
<tbody></tbody>
</table>
<input type=”button” name=”addtolist” value=”Add To List” onclick=”addRowTable()”>

No comments:

Post a Comment