jquery取子节点及当前节点属性值的方法
内容摘要
分享下jquery取子节点及当前节点属性值的方法。
<li class="menulink">
<a href="#" rel="external nofollow" id="101" onclick="changeMenu('101','资料管理','#' )"><s
<li class="menulink">
<a href="#" rel="external nofollow" id="101" onclick="changeMenu('101','资料管理','#' )"><s
文章正文
分享下jquery取子节点及当前节点属性值的方法。
<li class="menulink"> <a href="#" rel="external nofollow" id="101" onclick="changeMenu('101','资料管理','#' )"><span>资料管理</span> </a> </li>
取子节点:
$(".menulink a").each(function(){ var id=this.id; });
取当前节点:
$(".menulink ").each(function(){ var id=this.id; });
代码注释