jQuery clone element and insertAfter -
i trying clone simple div , insert after itself:
$(document).ready(function() { // clone , append $("div").clone().appendto("div"); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div style="height: 10px; background-color: blue; width: 600px; margin-bottom:1px"></div> why not working expect to?
append parent container instead
$(document).ready(function() { // clone , append $("div").clone().text('cloned div').appendto("body"); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div style="background-color: blue; width: 600px; margin: bottom:1px">original div</div> appendto('div') did not work because inserted cloned div @ end within existing div.
Comments
Post a Comment