Jquery method to take the child node and the current node attribute value

  • 2020-03-30 03:46:33
  • OfStack

Share how jquery takes the child node and the current node attribute value.


<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: