"Best way to get data attribute javascript values from an element?"
Hey y'all!
So I’ve been messing around with some HTML elements and need to grab those sweet data-* attributes. What’s the *simplest* way to get data attribute javascript values?
I’ve tried `element.dataset.something`, but sometimes it feels like overkill? Or maybe I’m just doing it wrong lol.
Also, is there a modern way to get data attribute javascript without jQuery? Cuz I’m tryna keep things lightweight.
Oh, and if your get data attribute javascript method isn’t working, maybe check for typos? Happens to me all the time smh.
Thanks in advance! 🚀
Hey y'all!
So I’ve been messing around with some HTML elements and need to grab those sweet data-* attributes. What’s the *simplest* way to get data attribute javascript values?
I’ve tried `element.dataset.something`, but sometimes it feels like overkill? Or maybe I’m just doing it wrong lol.
Also, is there a modern way to get data attribute javascript without jQuery? Cuz I’m tryna keep things lightweight.
Oh, and if your get data attribute javascript method isn’t working, maybe check for typos? Happens to me all the time smh.
Thanks in advance! 🚀
