run one time only why?? JavaScript
HTML Code
<table class="table" id="tbl1">
<tr>
<td>One</td>
<td><button class="mvFirst">One</button></td>
</tr>
<tr>
<td>Two</td>
<td><button class="mvFirst">Two</button></td>
</tr>
<tr>
<td>Three</td>
<td><button class="mvFirst">Three</button></td>
</tr>
</table>
Scripts
// plugin : move tr(row) on click to first
$.fn.moveFirst = function () {
debugger;
var ele=$(this).closest('tr').clone();
$(this).closest('tr').remove();
$(ele).prependTo('#tbl1');
};
$('.mvFirst').click(function () {
debugger;
$(this).moveFirst();
});
Why that working one time after this didn't work , I need to solve that please