I am cloning a set of elements, one of these elements is a button that would delete this set of elements when clicked on. My problem is that I cannot successfully bind a function to the button that does the deleting
// JS code $("#add_activity").click(function(){ var maxCount = [1,2,3,4,5]; var suffix = maxCount.shift(); $ ('#activity_container').find(".delete").livequery('click', function(event) { alert($(this).attr("id")); $(this).parent().remove() }); $ ('#activity_value0').clone().find("[id]").andSelf().each(function() { $(this).attr("id", $(this).attr("id") + suffix); $(this).attr("clone", suffix); }).end().end().appendTo('#activity_container') }); // end click // the HTML looks like this <div class="activity_container" id="activity_container"> <div id="activity_value0"> <select name="activity" id="activity"> <option value="0">Option 1</option> <option value="1">option 2</option> </select> <input name="delete" type="button" value="" class="delete" id="delete_activity"> </div> Thanks!