Possible Duplicates:
Storing arbitrary info in HTML tags for JavaScript?
What are the concrete risks of using custom HTML attributes?
Custom attributes - Yay or nay?
What are the drawbacks of adding a custom attribute on a standard HTML element?
For example:
<intput type="textbox" id="MyId" MyCustomeAttribute="MyData" />
By adding the MyCustomAttribute, I've made the document invalid, but what are the actual implecations? What problems, if any, will this cause?
I'd be using Javascript to read the values of the custom attributes.
Thanks
The drawback is that you can't use validation tools, because they'll complain about an "invalid" attribute.
HTML5 provides a valid way for us to do this, though (huzzah!): Use the prefix data-
for your own attributes, e.g., data-mycustomattribute
. And it works today in all major browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With