Duplicate an element on button-push with jQuery
- by paracaudex
I'm new to jQuery, and I'm trying to cause another identical dropdown menu to appear each time the user presses a button. I thought this would work, where #append is the button id and #foo is the dropdown id:
<script type="text/javascript">
$(document).ready(function(){
$("#append").click(function(){
$("#foo").append($("#foo"));
});
});
</script>
However, rather than duplicating the original dropdown, it causes it to disappear! What am I doing wrong?