dom - How can I determine the type of an HTML element in JavaScript? -


i need way determine type of html element in javascript. has id, element div, form field, fieldset, etc. how can achieve this?

nodename attribute looking for. example:

var elt = document.getelementbyid('foo'); console.log(elt.nodename); 

note nodename returns element name capitalized , without angle brackets, means if want check if element <div> element follows:

elt.nodename == "div" 

while not give expected results:

elt.nodename == "<div>" 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -