[b]"What's the best way to get data attribute JavaScript values from an element?"[/b] or [b]"How do I properly use

18 Replies, 1002 Views

`dataset` is the *right* way to get data attribute javascript values, but I get why it might feel extra.

If you want simplicity, `getAttribute()` is your friend.

Also, if you’re working with frameworks like React, they handle data attributes differently—just FYI!

Messages In This Thread



Users browsing this thread: 1 Guest(s)