我需要找到具有某个 img src 的属性的值。
<div class="ig_gallery_right_img" style="overflow-y: scroll">
<img src="/corp/homeowner/images/promo/gallery_traditional_3_sm.jpg"
swap-section="featured_bath_traditional_1"
swap-image="/corp/homeowner/images/promo/gallery_traditional_3.jpg"
class="gallery_sidebar_sm" />
<img src="/corp/homeowner/images/promo/gallery_traditional_5_sm.jpg"
swap-section="featured_bath_traditional_2"
swap-image="/corp/homeowner/images/promo/gallery_traditional_5.jpg"
class="gallery_sidebar_sm" />
</div>
我想知道是否有一种方法可以swap-section
通过图像源获取值。
我努力了var ig_sec = $('img', url_main_pic).attr('swap-section');
但这给了我一个未定义的价值。有任何想法吗 ?