Hi,
What is your opinion about using non valid attributes on html elements for easier jQuery selectors etc ?
Eg.
<div name="myDiv"></div>
According to Visual Studio the name attribute is not valid for a div element.
Hi,
What is your opinion about using non valid attributes on html elements for easier jQuery selectors etc ?
Eg.
<div name="myDiv"></div>
According to Visual Studio the name attribute is not valid for a div element.
If you absolutely must, use the data
pseudo-namespace; such as data-id
or data-name
.
Edit: Using the data
pseudo-namespace is far better than perverting the usage of an existing attribute like class
or id
.
If you still wanted to remain w3c compliant, the w3c allows title
attribute for extra information, which you can use in lieu of adding new non-standard attributes.
I would recommend using "dummy" classes (and the jQuery class selector) to disambiguate naming of html elements. 100% compliant approach.