Thursday, August 21, 2014

Copy text/data from id/class/selector and past another place jquery

Copy anything from one class /div/id/element and past in other via jquery.
Example

<html>
<body>
<div id="copyID">
Hello sharif
</div>

<div id="pastID">

<div>

<script>
$(document).ready(function() {
    $("#copyID").click(function() {
        $("#pastID").html($(this).html());
    });
});
 </script>
</body>
</html>

Now Hello sharif will show in "pastID" div.
Thanks

Total Pageviews