I have this code: $('a#addPlayer').click(function() { $('<p><img class="remove" src="img/ui/forbidden.jpg" alt="Remove" \/ > <label for="playerName-'+pi+'">Player Name: <\/label><input type="text" class="required" name="playerName-'+pi+'" \/> <label for="playerNumber-'+pi+'">Player Number: <\/label><input type="text" name="playerNumber-'+pi+'" class="required" size="2" \/><\/ p>').insertBefore($(this).parent()); pi++; return false; });
Then I have this: $('img.remove').click(function() { console.log('test'); return false; }); It will not register the click and write test to the console in FF. Do I have to use .bind('click','fn')? or another method to have click fire on dynamically added elements to the DOM? Using 1.2.3 jQuery