Hacker News new | ask | show | jobs
by robin_reala 5246 days ago
Not sure you should be (ab)using data- attributes like that. They’re already a key/value pair so you markup your data as <div data-tooltip-foo="baa" data-tooltip-qux="quux">
1 comments

If you have many options, they are easier to retrieve, just call .data('tooltip') and jQuery will do the parsing of the object. Using separate attributes you would have to call .data() for every attribute. Anyway, I guess any of the two methods would be fine! :-)