Old Geezer Old Geezer - 23 days ago 9
Javascript Question

Unable to get the NAME property from the DOM

I am unable to get the

name
attribute directly as a property of a DOM object.

As seen from a screenshot of Chrome Developer Tools, there is no property called
name
for a typical
div
object:

enter image description here

Am I missing something basic?

Answer

You can use element.getAttribute('name') and it will return value of name attribute from any elements.