我试图在超链接标记内插入图像。如何将<img>元素插入<a>元素
当前的标记:
<div class="Example">
<a href="http://www.Example.com">
<img src="http://www.Example.com/Sloth.jpg">
</a>
</div>
我想插入
<img class="example" src="http://www.Example.com/JellyFish.jpg">
所以标记如下:
<div class="Example">
<a href="http://www.Example.com">
<img src="http://www.Example.com/Sloth.jpg">
<img class="example" src="http://www.Example.com/JellyFish.jpg">
</a>
</div>
问题
我怎样才能通过Javascript或JQuery做到这一点?
Dom操作:在它后面找到img标签,'.append()'你的新图像。 –