I want to get the image src from a div with id post and want to append it inside a div with id show-image
Also I want to wrap the javascript in a function so that I can implement it in webpage
so far i have created this
var theDiv = document.getElementById("show-image");
var tubeimg = document.getElementById('post-img').getAttribute('src');
theDiv.innerHTML += "<img src=" +tubeimg+ " />";
for the Html coding
<div id='show-image'>
</div>
<div id='post'>
<div class='inner'>
<img id='post-img' src='http://3.bp.blogspot.com/-Sg5t3utxRzc/UwgyzbLVAAI/AAAAAAAAFBo/vYQX0Cphx8U/s1600/indian-bride.jpg'/>
</div>
</div
Right now I am using document.getElementById("img id").getAttribute('src'; but I want this
var post = document.getElementById("post"),
var tubeimg = post.documentgetElementByTagName("img").getAttribute('src');
But tis is not working I don't know where I am getting wrongc an anyone please fix this please
I want pure javascript no jquery