views:

45

answers:

1

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?

+1  A: 

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.

Francisc