我有一个div标签
<div id="theDiv">Where is the image?</div>
我想在div中添加一个图像标记
End result:
<div id="theDiv"><img id="theImg" src="theImg.png" />Where is the image?</div>
我有一个div标签
<div id="theDiv">Where is the image?</div>
我想在div中添加一个图像标记
End result:
<div id="theDiv"><img id="theImg" src="theImg.png" />Where is the image?</div>
您是否try 过以下操作:
$('#theDiv').prepend('<img id="theImg" src="theImg.png" />')