当我想替换属性img时,我遇到了问题。
在class="HotProject_item HotProject_item_preview isotope-item"
内容class =“content-asset”中有
<img src="/Uploads/images/0110/112/image012.jpg"
。
我想用新图片更改img src。你能帮助我吗?
<div class="HotProject_item HotProject_item_preview isotope-item" zorder="1" row-num="1" data-id="149"
enddate="31/12/2014" mark="10" style="position: absolute; left: 0px; top: 0px; -webkit-transform: translate3d(0px, 0px, 0px);">
<div class="content content_1 work" data-id="149" orgclass="content_1" curclass="content_1">
<div class="content-tl">
<div class="content-tr">
</div>
</div> <div class="content-bl"> <div class="content-br"> <div class="content-main">
<div class="content-mask-tl"></div> <div class="content-mask-tr"></div> <div class="content-mask-bl"></div> <div class="content-mask-br">
</div> <div class="content-inner">
<div class="content-top">
<div class="content-asset"> <a href="javascript:void(0);" data-id="149"> <img src="/Uploads/images/B%C3%ACnh%20ch%E1%BB%8Dn%20sp/thang%207/tu-lanh-1.jpg" alt=""> </a>
</div>
</div>
<div class="content-info"> <p class="title"> <a href="javascript:void(0);" data-id="149">Title ABC</a> <a href="javascript:void(0);" class="expand"> <img src="../HotProject/Css/img/more.png"> </a> </p>
<div class="divider"><span></span></div>
<div class="subtitle summary" style="visibility: visible;">
Decription :)
</div>
<div class="subtitle description" style="visibility: visible;">
Subtitle
</div> </div> </div> </div> </div> </div>
</div>
<div class="content_detail">
</div>
</div>
答案 0 :(得分:2)
这样做
$(".content-asset img").attr("src","newimg.jpg");
这意味着,将其source属性更改为指向newimg.jpg