复制HTML / PHP中的完整部分

<section id="123">
    <div id="456">
        some Data Here
    </div>
</section>

I am a beginner to this and I need to copy data from section and div with their respective ids and use it some where else in my code. Please Help. Thanks for your time.

You can use

var htmlstring = $("#123").html();

.html() Function in jquery

Put your HTML in a php variable , and use it as you want

 $div = '<section id="123">
        <div id="456">
            some Data Here
        </div>
    </section>';