jquery append a tr after calling
- by marharépa
Hello!
I've got a table.
<table id="servers" ...>
...
{section name=i loop=$ownsites}
<tr id="site_id_{$ownsites[i].id}">
...
<td>{$ownsites[i].phone}</td>
<td class="icon"><a id="{$ownsites[i].id}" onClick="return makedeleterow(this.getAttribute('id'));" ...></a></td>
</tr>
{/section}
<tbody>
</table>
And this java script.
<script type="text/javascript">
function makedeleterow(id)
{
$('#delete').remove();
$('#servers').append($(document.createElement("tr")).attr({id: "delete"}));
$('#delete').append($(document.createElement("td")).attr({colspan: "9", id: "deleter"}));
$('#deleter').text('Biztosan törölni szeretnéd ezt a weblapod?');
$('#deleter').append($(document.createElement("input")).attr({type: "submit", id: id, onClick: "return truedeleterow(this.getAttribute('id'))"}));
$('#deleter').append($(document.createElement("input")).attr({type: "hidden", name: "website_del", value: id}));
}
</script>
It's workin fine, it makes a TR after the table's last tr and put the info to it, and the delete also works fine.
But i'd like to make this AFTER the tr which calling the script. How can i do this?
I've tried it with closest() but not work :(