Jquery:: add table row, remove table row

Posted: January 26, 2011 in HTML, Javascript

<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()”>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s