Reputation: 2785
I'm trying to add some custom data within a tag to reference later in a jQuery call, and I usually use "rel=" for something like this. However, I'm working in an XHTML Transitional document, and it gives me a "there is no rel attribute".
Are there any alternate attributes I can use to attach custom data to an HTML tag while still keeping the document valid?
Upvotes: 1
Views: 974
Reputation: 80485
If you care much about XHTML validity in the case you mentioned, a common practice is to use the class attribute and space different things there.
HTML5 allows this via the data attribute or rather prefixing your own custom attributes with data-, e.g. data-my-var="hello". But this is invalid in XHTML.
Upvotes: 3