i am a live() user and i know somehow live() is deprecated. i've tried to use bind() to have the event on new added dom working, but it's not.
can you please tell me how to do bind() properly ? or is there any other method to do this task?
this is the html:
<table>
<tr>
<td> hi there <span class="click">click me</span></td>
<tr>
<tr>
<td> hi there2 <span class="click">click me</span></td>
<tr>
<tr class="end">
<td></td>
</tr>
</table>
<button class="add_new">add new row</button>
this is the js :
var new_row = '<tr><td> hi there, new row! <span class="click">click me</span></td><tr>';
$('.add_new').click(function() {
$('.end').before(new_row);
});
$('.click').bind('click', function() {
alert('clicked');
});
if possible, i want to use native jquery's method and not plugins. this is my jsfiddle http://jsfiddle.net/bondythegreat/z3uXH/