How do I get a link to link to link to remove the correct line?
<tr>
<td>c1r1</td>
<td>c2r1</td>
<td><a href="javascript:delete_row();">delete</a></td>
</tr>
<tr>
<td>c1r2</td>
<td>c2r2</td>
<td><a href="javascript:delete_row();">delete</a></td>
</tr>
function delete_row() {
this.parent().parent().remove();
}
I know what I can use (in jQuery)
$('a').click(function() {
this.parent().parent().remove();
}
Or even that
$('a').live('click', function() {
this.parent().parent().remove();
});
To bind a function to dynamically created links.
But I'm looking for a way to get a link to a link without jquery. I use jquery inside a function, but that is not the point.
Edit
Many suggest using thisfunction as a parameter, I tried this, but it returns window:
<a href="javascript:delete_row(this);">delete</a>
function delete_row(elem) {
console.log(elem);
}
Firebug console: Window config_maker.php
source
share