Jquery takes the child node and the current node attribute value

  • 2020-03-30 03:35:29
  • OfStack

<li class="menulink">
<a href="#" rel="external nofollow" id="101" onclick="changeMenu('101',' Data management ','#' )"><span> Data management </span>
</a>
</li>

Take the child node:


$(".menulink a").each(function(){ 
var id=this.id;
});

Take the current node:


$(".menulink ").each(function(){
var id=this.id;
});

Related articles: