I'm following code from jquery append and remove dynamic table row (http://jsfiddle.net/samliew/3AJcj/2/)
I already organized my table.
But remove function didn't work, how I change this code?
I can't understand about $(this).parent().parent().remove();
code.
$(document).ready(function(){
$(".addCF").click(function(){
$("#addTg").after('<tr><td class="tg-yw4l" ><input type="text"></td><td class="tg-yw4l" colspan="2" ><input type="text"></td><td class="tg-yw4l" ><input type="text"></td><td><a href="javascript:void(0);" class="remCF" >Remove</a></td></tr>');
});
$("#addTg").on('click','.remCF',function(){
$(this).parent().parent().remove();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<table class="tg">
<tr>
<td class="tg-mtwr">DATE</td>
<td class="tg-mtwr" colspan="2" >CONTENTS</td>
<td class="tg-mtwr">PRICE</td>
<td class="tg-mtwr">BUTTON</td>
</tr>
<tr id="addTg">
<td class="tg-yw4l" ><input type="text"></td>
<td class="tg-yw4l" colspan="2" ><input type="text"></td>
<td class="tg-yw4l" ><input type="text"></td>
<td class="tg-yw4l"></td>
</tr>
<tr>
<td colspan="5" style="border:0px solid #fff;">
</td>
</tr>
</table>
<button onclick="myFunction()" class="addCF" >Add</button>