1
我有jQuery的foreach循環通過每個 'div.panel' 走,我需要這個div內訪問圖像的IMG SRC ...jquery如何訪問imr src?
HTML:
<div class="panel" title="Sean Gay">
<div class="wrapper"><img src="/Media/people/SeanGay.jpg" alt="Sean Gay" class="person">
<div class="vcard"><span class="fn">Sean Gay</span> <span class="title">Chief Storeman</span>
</div>
</div>
</div>
的jQuery:
jQuery(this).find("div.panel").each(function(n) {
var title = jQuery(this).attr("title");
這讓我的面板的標題,在這個循環內我需要包裝的圖像的src沒有.jpg
擴展名。
我怎樣才能做到這一點?
變化'title'爲'src'然後執行字符串操作 – scibuff 2012-03-20 14:10:56