I’m trying to make an upload form that allows you to create multiple inputs. Each input has a delete button to remove it. I’ve tried both live() and bind().
I’m having difficulty getting the delete button to work on appended elements.
What do I have wrong here?
Thanks
E
//image uploaders
loader='<li>'+
'<label>Upload Image</label>'+
'<input id="upload_image" type="text" size="36" name="upload_image" value="" style="width:360px;" />'+
'<input id="upload_image_button" type="button" value="Upload Image" style="width:100px;" />'+
'<input class="delete" type="button" value="X" style="width:20px;float:right;" />'+
'</li>';
jQuery('#add_image').live("click", function(){
jQuery('#image_uploaders').append(loader);
return false;
});
jQuery('.delete').click(function(){
jQuery(this).parent().remove();
});