/    Sign up×
Community /Pin to ProfileBookmark

Does anyone use the HTML5 data attribute to tag data to DOM elements?

One useful extra within HTML5 is the data attribute. You can tag a piece of data to a DOM element and do things like making a page control responsive, can go into this more.
Right now, does anyone use the attribute?
This attribute can be used to display different content on different screens, anyone tried that?

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@Major_PayneSep 20.2014 — Might help:

How to Use HTML5 Data Attributes

Using data attributes

I haven't used any data attributes in my HTML5, but do have meta tags for media sizes and the CSS for the breakpoints needed.
Copy linkTweet thisAlerts:
@deathshadowSep 21.2014 — To me the data attribute is one of those things in HTML 5 I just don't get the point of; if it's a trigger for style use a class -- if it's data, why the blazes isn't it in there as plaintext?

If it's neither of those things, what the blazes is it doing in the markup?!?

It's scripting only data, so it BELONGS in the scripting, [b]NOT[/b] the markup. Kind of why I say the various on[i]event[/i] attributes should be removed from the MARKUP specification entirely, and why things like CANVAS shouldn't even have a tag in the first blasted place... at BEST CANVAS is redundant to NOSCRIPT, at worst it serves no legitimate purpose other than code bloat and "throwing more tags at it".

I've not seen anything done with the "data-" attributes that didn't fall into two categories -- stuff I could do more easily without it, or stuff that has no blasted business on a website in the first place! In many ways it just reeks of the typical "I can writez javascripts?" nonsense I expect from people dumb enough to see a legitimate reason to use jQuery, JS to do CSS' job, and a host of other broken inaccessible slow loading garbage that everyone's throwing at websites out of ignorance, apathy and wishful thinking.
Copy linkTweet thisAlerts:
@stevedevauthorSep 26.2014 — I think users of HTML 5 tools are simply realising the benefits and it just can't be denied...

I am looking into how jResponse uses the attribute and am keen to see the responsive outcome of apps created.
×

Success!

Help @stevedev spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...