Reputation: 2691
so the problem is, that i want to insert a new row after another row in my html here is my html
<html>
<head>
<title>JQuery Problem 2</title>
<script type="text/javascript" src="jquery-1.4.min.js"></script>
<script type="text/javascript" src="problem2.js"></script>
</head>
<body>
<div id="game">
<form onsubmit="return false">
<p>
Guess:
<input type="text"/>
<input type="submit" value="Go"/>
</p>
<p>
<strong>Number of guesses:</strong>
<span>0</span>
</p>
<p>
<strong>Last guess:</strong>
<span>None</span>
</p>
<table border="1" cellpadding="4" cellspacing="1" style="width: 400px">
<tr>
<th>Guess</th>
<th>Result</th>
</tr>
</table>
</form>
</div>
</body>
My question is I want to insert a new row after the tr with the headers.
Upvotes: 0
Views: 857
Reputation: 5695
$('#game table').append ($('<tr><td>col 1</td><td>col 2</td></tr>));
Upvotes: 0
Reputation: 630389
Something like this, but you need to construct the row yourself:
$(function(){
$('tr:first').after('<tr><td>0</td><td>0</td></tr>');
});
Upvotes: 1