How to get the name of an element with Javascript?

后端 未结 5 594
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-20 01:16

I\'m trying to get the name of an element in Javascript. Meaning if the element is

, then \"div\" would be returned. If it\'s &l
5条回答
  •  伪装坚强ぢ
    2021-01-20 01:23

    You want element.nodeName Or, within jQuery:

    $(".includeMe").each(function(){
      alert(this.nodeName);
    });
    
    
    
    Hello World

    Don't forget me as well

提交回复
热议问题