what is the difference between append() and insertAfter()
I want to give functinality to add and remove rows dynamically using jQuery.
if i add a row in table using "append()" and try to access newly added row,( with last() or slice() )
then it references the the last row before new rows inserted dynamically.
Instead if i use insertAfter(), i can reference the new rows correctly. what can be the issue?
Works wrongly:
$("#tbl2 > tbody > tr").last().append('<tr"><td>1</td><td>2</td><td>3</td></tr>');
$("#tbl2 > tbody > tr").last().remove();
Works as desired :
$('<tr"><td>1</td><td>2</td><td>3</td></tr>').insertAfter($("#tbl2 > tbody > tr").last());
$("#tbl2 > tbody > tr").last().remove();