javascript - Take element ( ID ) and show it anywhere on page -


this tricky question , have little knowledge of js, well, trying pick element page , show on anywhere calling it.

actually, element coming different source in header, , want show in content area. used margin-top -1000px value on different page render on different height of page. in heading overlapping text because can"t make exact on every page.

so, looking solution pick element , call in specific area of webpage , hide css

 <div id="places"> <img src="foo.png"/></div> 

so, there way pick places webpage , call anywhere in webpage again.

thank :)

yes, create var stores value , add value other div.

the div content:

<div id="places"> <img src="foo.png"/></div> 

the div want display content other div:

<div id="my_div"></div> 

js:

$( document ).ready(function() {     var places = $('#places').html(); //grab html first div     $('#my_div').append(places); //add html second div }); 

js fiddle demo


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -