Wow, thanks everyone! Didn’t expect so many replies.
I tried both `dataset` and `getAttribute()`—both work, but `dataset` does feel cleaner for my use case.
One follow-up: what if the data attribute is dynamically added? Does `dataset` pick that up automatically, or do I need to refresh something?
Also, big thanks for the MDN link—super helpful! 🚀
I tried both `dataset` and `getAttribute()`—both work, but `dataset` does feel cleaner for my use case.
One follow-up: what if the data attribute is dynamically added? Does `dataset` pick that up automatically, or do I need to refresh something?
Also, big thanks for the MDN link—super helpful! 🚀
