How to get the attribute value of a DOM element in JavaScript?
Originally posted here!
To get the attribute values from a DOM element, you can use the getAttribute() element method in JavaScript.
Let's say you have an h1 html tag with custom attribute data-color like this,
<h1 data-color="red">Heading</h1>
Her...
melvingeorge-me.hashnode.dev2 min read