innerhtml - jQuery Wraping innterHTML div with Class -


i want able copy text element id 'mymodal' 'purchasenotice' , wrap 'purchasenotice' new class.

var mydiv1 = document.getelementbyid('mymodal'); var mydiv2 = document.getelementbyid('purchasenotice').wrapinner( "<div class='new'></div>"); mydiv2.innerhtml = mydiv1.innerhtml; 

the code above works until add .wrapinner( "") - how shall wrap this?

if you're using jquery can : demo

$(document).ready(function(){       $('#purchasenotice').html($('#mymodal').html()).wrapinner("<div class='new'></div>");    }); 

update

sorry, noticed wanted wrap purchasenotice in new div. use wrap() see here : http://jsfiddle.net/32tax/1/

$(document).ready(function(){       $('#purchasenotice').html($('#mymodal').html()).wrap("<div class='new'></div>");    }); 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -