I want to get the name of a certain tag (to tell whether it is a div/input/span/p/so on)
I found that there are 3 different attributes that give me the tag name:
tagName, nodeName, and localName
My question is: Which one is the most supported in all browsers? And/or is there a method to get the ta开发者_如何学JAVAg name in Prototype (I looked but couldn't find one)?
nodeName is the most consistent here. I would suggest you take a minute and read this post for a few differences and inconsistencies with tagName if you're more curious as to why.
For the prototype part of the question...it's a JavaScript property, just this.nodeName should work or element.nodeName, whatever your element's called in the current function should work.
加载中,请稍侯......
精彩评论