Answers:
您是否尝试过以下方法:
$('#theDiv').prepend('<img id="theImg" src="theImg.png" />')
我的2美分:
$('#theDiv').prepend($('<img>',{id:'theImg',src:'theImg.png'}))
如果我们想在<div>每次image()调用函数时更改tag 的内容,我们必须这样做:
Java脚本
function image() {
var img = document.createElement("IMG");
img.src = "/images/img1.gif";
$('#image').html(img);
}
的HTML
<div id="image"></div>
<div><a href="javascript:image();">First Image</a></div>