I am trying to get the element name in Javascript. The value, if the element is <div /> , will be returned by "div" . If it is <img src="" /> , then "img" will be returned. I use jquery to select a bunch of elements and then call a custom function for all of them. As part of this function, I want to know what I'm dealing with. How to do it?
It seems to be easy. And I think I did it before, but I just can't find it. Google results continue to give me βget the item by nameβ no matter how I express it.
source share