What's the best way to use javascript get data attribute from an element? or How do you properly use

22 Replies, 1492 Views

Performance nerds might say `getAttribute()` is better, but unless you’re building a AAA game, just use what’s readable.

`.dataset` looks nicer, and modern JS is all about clean code.

Check out jsPerf if you wanna test speed yourself!

Messages In This Thread



Users browsing this thread: 1 Guest(s)