I am appending div in existing div and then one more div into append div but it not work for me. what am I doing wrong. please help
<head> <script type="text/javascript"> $(function(){ $('a').click(function(){ var cl=$('#free').clone(); var jj=$('.append') var mm=jj.append('<div class="hii"></div>') mm.append(cl) }) }) </script> </head> <body> <div style="background:#F00; width:500px; height:50px" id="free"></div> <a href="#">hide</a> <div class="append"></div> </body>
;.id'free', so you're creating an element that doesn't have an unique identifier. This isn't valid HTML, so avoid doing that. Instead ofid="free", doclass="free". Also, what is going wrong with this? Can you create a fiddle or something like that which demonstrates this problem?