我需要img
在每个div
. 我面临的问题是每个div
. 我需要img
在每个div
.
我正在使用的代码:
$("div.level_1").each(function() {
$("a.lightview").wrapInner($("img.euImg"));
});
起始代码:
<div class="level_1 euItem group3 generation_y _2012">
<img border="0" src="img1.jpg" class="euImg" alt="Run">
<h4>
<a href="/sport/sport_2014/media_gallery/images/run.htm" class="lightview" data-lightview-group-options="controls: 'thumbnails'">
<span>Run</span>
</a>
</h4>
<p>Praesent placerat purus in lobortis egestas. Etiam lectus augue, viverra in ultricies vitae, accumsan eu arcu. Phasellus auctor fringilla sem non imperdiet.</p>
<span class="clear"> </span>
</div>
<div class="level_1 euItem group3 generation_y _2012">
<img border="0" src="img2.jpg" class="euImg" alt="Run">
<h4>
<a href="/sport/sport_2014/media_gallery/images/bike.htm" class="lightview" data-lightview-group-options="controls: 'thumbnails'">
<span>Run</span>
</a>
</h4>
<p>Praesent placerat purus in lobortis egestas. Etiam lectus augue, viverra in ultricies vitae, accumsan eu arcu. Phasellus auctor fringilla sem non imperdiet.</p>
<span class="clear"> </span>
</div>
需要的结果代码:
<div class="level_1 euItem group3 generation_y _2012">
<h4>
<a href="/sport/sport_2014/media_gallery/images/run.htm" class="lightview" data-lightview-group-options="controls: 'thumbnails'">
<img border="0" src="img1.jpg" class="euImg" alt="Run">
</a>
</h4>
<p>Praesent placerat purus in lobortis egestas. Etiam lectus augue, viverra in ultricies vitae, accumsan eu arcu. Phasellus auctor fringilla sem non imperdiet.</p>
<span class="clear"> </span>
</div>
<div class="level_1 euItem group3 generation_y _2012">
<h4>
<a href="/sport/sport_2014/media_gallery/images/bike.htm" class="lightview" data-lightview-group-options="controls: 'thumbnails'">
<img border="0" src="img2.jpg" class="euImg" alt="Run">
</a>
</h4>
<p>Praesent placerat purus in lobortis egestas. Etiam lectus augue, viverra in ultricies vitae, accumsan eu arcu. Phasellus auctor fringilla sem non imperdiet.</p>
<span class="clear"> </span>
</div>