I am trying to append a table cell using the following javascript function:
function fn() {
$(this).parent().parent().parent().append("<tr><td >some text</td></tr>");
}
and have a link inside a table cell <td></td> with the following link:
<a href="#" onclick="fn();">+</a>
I am very new to jquery and am just trying to append a table with any text for now but nothing is happening when I click the link inside the table cell.
I am using MVC and razor, could anyone me get this to work?
You need to pass
thisto your function:And