我有以下結構如下。使用jQuery我需要獲取每個鏈接並在其下面顯示href。我可以使用一些子選擇編寫代碼爲每個但我只是想寫的東西,它會爲所有的div的「關口」類,並且將允許未來增加...通過div和顯示文本jQuery循環
<div class="col">
<a href="http://google.com">Google</a>
</div>
<div class="col">
<a href="http://yahoo.com">Yahoo!</a>
</div>
<div class="col">
<a href="http://facebook.com">Facebook</a>
</div>
<div class="col">
<a href="http://twitter.com">Twitter</a>
</div>
上述應變成...
<div class="col">
<a href="http://google.com">Google</a>
<span>http://google.com</span>
</div>
<div class="col">
<a href="http://yahoo.com">Yahoo!</a>
<span>http://yahoo.com</span>
</div>
<div class="col">
<a href="http://facebook.com">Facebook</a>
<span>http://facebook.com</span>
</div>
<div class="col">
<a href="http://twitter.com">Twitter</a>
<span>http://twitter.com</span>
</div>
任何幫助表示讚賞!
甚至不知道從哪裏begin..If我店裏的.COL一個「HREF到一個變量,它會被每個被覆蓋..在一段時間內沒有做過這樣的事情 – stewart715 2012-03-01 18:48:57