Reputation: 5329
I.e. we've got a #<HTMLDivElement>
:
<div class="cool-class" name="2" action="someAction" id="ext100">button</div>
How can tags' values be accessed?
E.g.
someAction
from action
tag, or2
from name
?Upvotes: 0
Views: 335
Reputation: 740
After you get the HTMLDivElement, for example coolElement, you can try this:
coolElement.attributes['name']and
coolElement.attributes['action'].In case the attribute exists, you can get the value with nodeValue
coolElement.attributes['attribute_name'].nodeValue
Upvotes: 1