I have a table on my page like this:
<table border="1">
<tr>
<td>first</td>
<td><a href="#">first click</a></td>
</tr>
<tr>
<td>second</td>
<td><a href="#">second click</a></td>
</tr>
<tr>
<td>third</td>
<td><a href="#">third click</a></td>
</tr>
<tr id="change">
<td colspan="2">
<button>change</button>
</td>
</tr>
</table>
When I click on of the links, I want the move ‘#change’ under the clicked link’s . For example; when I click on “first click” table changes like this..
<table border="1">
<tr>
<td>first</td>
<td><a href="#">first click</a></td>
</tr>
<tr id="change">
<td colspan="2">
<button>change</button>
</td>
</tr>
<tr>
<td>second</td>
<td><a href="#">second click</a></td>
</tr>
<tr>
<td>third</td>
<td><a href="#">third click</a></td>
</tr>
</table>
How can I do it with JQuery?
Try this:
fiddle