Duplicate an element on button-push with jQuery
        Posted  
        
            by paracaudex
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by paracaudex
        
        
        
        Published on 2010-04-06T01:05:00Z
        Indexed on 
            2010/04/06
            1:13 UTC
        
        
        Read the original article
        Hit count: 303
        
jQuery
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?
© Stack Overflow or respective owner