Anz Joy
Anz Joy

Reputation: 187

Extract image form a div and insert it into another div using javascript

I have the following html

<Div id=Qimage>
<a href="http.wwww.....somehitng">
<img class="postphoto" src="">
</a>
</div>

<Div id=Limage>
<a href="www.designerzblog.com" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="/feather/wp-content/uploads/2014/02/06.jpg"></a>
</div>

I need to move ONLY image from #Limage and insert it in the src of #Qimage. After insert the #Limage should be invisible.

How can do this in simple javascript??

Upvotes: 0

Views: 57

Answers (1)

Felix
Felix

Reputation: 38102

You can do:

$('#Qimage img').attr('src', $('#Limage img').attr('src'));

Upvotes: 3

Related Questions