0
我有三個標籤「B1」,「B2」和「B3」。我想克隆該HTML並將其作爲三個標籤的內容加載,其標識爲id = "bv-B1-p1"
,id = "bv-B2-p1"
和id = "bv-B3-p1"
(即根據所選標籤替換-brand-
與B1
,B2
或B3
)。克隆HTML並根據所選標籤替換內容ID
<div id="bv-brand-priority">
<div>
<ul>
<li><a href="#bv-brand-hp"><span>Static Tab</span></a></li>
<li><a id="addTab" href="#" ><span>+</span></a></li>
</ul>
<div id="bv-brand-hp">
</div>
<div id="bv-brand-p">
<div id="bv-brand-eng-media-image-p-img">
</div>
<!--clicking this link should append another similar div to the above div with incremented id i.e id="bv-brand-eng-media-image-p-img1"-->
<a href="#" id='bv-brand-eng-add-media-image-p'>Add New Image</a>
</div>
</div>
</div>
爲什麼不試試循環? – Unknown 2011-12-19 04:49:10
我是新來的jquery ..請告訴我如何 – 2011-12-19 04:58:12
你可以發佈完整的代碼,並問什麼是提取問題 – 2011-12-19 05:14:55