Possible Duplicate:
Custom attributes - Yea or nay?
Can any side effect occur in browsers if I add custom attributes to html tags for instance:
<a href="" mycustomtag="mydata"></a>
By custom attribute, we mean you can add any type of attribute to any given HTML element. If you are just creating a static web page that has nothing other than HTML and CSS, then adding custom attributes to HTML elements is generally not needed and is not necessary.
You can use getAttribute() and setAttribute() in JavaScript to get and set the value of different data attributes. The getAttribute method will either return null or an empty string if the given attribute does not exist. Here is an example of using these methods: var restaurant = document.
Using the same attribute name twice in a tag is considered an internal parse error. It would cause your document to fail validation, if that's something you're worried about. However, it's important to understand that HTML 5 defines an expected result even for cases where you have a "parse error".
The multiple attribute in HTML allows user to enter more than one value. It is a Boolean attribute and can be used on <input> as well as <select> element, To allow multiple file uploads in HTML forms, use the multiple attribute. The multiple attribute works with email and file input types.
No side effects that I know if, they just won't validate and it's possible that in the future whatever attribute name you choose may conflict if browsers decide to implement one with the same name (Unlikely if you name it something unique enough)
Read more here: Custom attributes - Yea or nay?
This is fine, except that if you try to validate your markup, this will cause it to fail.
Otherwise, from a browser perspective there shouldn't be a problem.
Everyone will be kind to you (JavaScript, CSS, HTML) but your page will not validate.
If you decide to use custom attributes, prefix them with data-
to make them forward compatible with HTML5 (and to not use a possible reserved attribute in the future).
<a href="http://example.com" data-myatt="mydata">click?</a>
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