Jump to content

Html custom elements to a tag

MrKickkiller
Go to solution Solved by msevilgenius,

Custom data attributes are part of the html standard: http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes

they just need to start with data-

Hi

 

Quick question about Html.

I believe I have seen/heard this somewhere.

 

But is this possible?

<div class ='ChooseAClass' custom-data1="y" custom-data2="z">

 

Would be very handy for storing things like x and y values for elements in a grid.

The way I have been doing it now, is simply storing those values in the id

That time I saved Linus' WiFi pass from appearing on YouTube: 

A sudden Linus re-appears : http://linustechtips.com/main/topic/390793-important-dailymotion-account-still-active/

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry i am not a HTML programmer. I have a slight understanding of C#, but that is about it. 

CPU: Intel I7 4790K 4.8 Ghz || Mobo: ASUS ROG Maximus Hero 6 Z87 || Ram: Corsair Vengeance 16 GB 1600 Mhz || GPU: ASUS GTX 980 Ti STRIX || Storage: 2 x SSD Samsung 840 EVO 250 GB RAID 0 HDD Western Digital 1 TB Black || PSU: Corsair AX 860 watt || Cooling: 2 x AF 140mm (front), 2 AF120 Blue LED (bottom and back), 2 SP120 (top on radiator) ||  CPU cooler: Corsair H100i GTX || Case: Corsair obsidian 750D <3 <3 <3 

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry i am not a HTML programmer. I have a slight understanding of C#, but that is about it. 

 

Then why did you reply to me? :P

That time I saved Linus' WiFi pass from appearing on YouTube: 

A sudden Linus re-appears : http://linustechtips.com/main/topic/390793-important-dailymotion-account-still-active/

Link to comment
Share on other sites

Link to post
Share on other sites

Then why did you reply to me? :P

Cuz i was reading it xD and i was bothered to look it up still found nothing :) 

CPU: Intel I7 4790K 4.8 Ghz || Mobo: ASUS ROG Maximus Hero 6 Z87 || Ram: Corsair Vengeance 16 GB 1600 Mhz || GPU: ASUS GTX 980 Ti STRIX || Storage: 2 x SSD Samsung 840 EVO 250 GB RAID 0 HDD Western Digital 1 TB Black || PSU: Corsair AX 860 watt || Cooling: 2 x AF 140mm (front), 2 AF120 Blue LED (bottom and back), 2 SP120 (top on radiator) ||  CPU cooler: Corsair H100i GTX || Case: Corsair obsidian 750D <3 <3 <3 

Link to comment
Share on other sites

Link to post
Share on other sites

I don't think anything like that is possible. (I was wrong, see other answers below)

 

 How about using hidden inputs instead?

<input type="hidden" name="custom-data1" value="y">
Link to comment
Share on other sites

Link to post
Share on other sites

Custom data attributes are part of the html standard: http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes

they just need to start with data-

 

We have a winner.

 

Use

jQuery.data()

to manipulate easily with Javascript if you have jQuery available.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×