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
Post a Comment