jQuery循环子节点并获取值

<div class="left_tree_ad_btn_container">
  <ul>
	<li class="tree_ad_btn_bg"><img src="/images/insurance/3lianad_small.jpg" />            </li>
  </ul>
  <ul>
	<li class="tree_ad_btn_bg have_bg"><img src="/images/insurance/3lianad_small.jpg" /></li>
  </ul>
  <ul>
	<li class="tree_ad_btn_bg"><img src="/images/insurance/3lianad_small.jpg" /></li>
	</ul>
</div>


var arrUl = jQuery(".left_tree_ad_btn_container > ul");
jQuery.each(arrUl, function(){
  alert(jQuery(this).find("img").attr("src"));
  alert(jQuery(this).find("li").attr("class"));
});

你可能感兴趣的:(jquery,each,子节点)