I want a div to be duplicated when a button is clicked. I though something like this; but it\'s not working. Can anyone help me?
HTML
Can you change the div to a class? If so, then this might work for you:
# application.js
$(function(){
$('.photo:last').after('Add another image
');
$('a[href=#]').click(function(){
$(this).before($('.photo:last').clone());
$('.photo:last input').each(function(){
$(this).removeAttr("value");
});
$('.photo:last input[type=hidden]').remove();
return false;
});
})
#html
label
Edit the code here: