views:

140

answers:

4

Just to be sure it can be safely used with JQuery scripting.

+4  A: 

It's part of the HTML 4.01 Specification and should only be used as an attribute of the a and link tag (see the spec). Within a and link tags, it's well supported.

Dominic Rodger
+1  A: 

You'd really need to expand on what you mean by "compatible with all browsers". All browsers will be able to render a document containing rel attributes without barfing, even if they don't explicitly understand what it means. However, if you want to know whether all major browsers would take an explicit action when they encounter a rel attribute, you'd need to specify what situation you're thinking of and what you hope the browsers would do.

As for being compatible with all tags - no, the rel attribute is only appropriate for A and LINK tags in HTML 4 (as per the spec).

Andrzej Doyle
+3  A: 

According to the HTML 4.01 specification, rel is only valid on a and link elements.

As browsers don't validate documents you can get away with using it on any element you like, but it won't be valid, and it will be semantically meaningless.

NickFitz
A: 

If you want to store custom data, you're better off using custom attributes. If you prefix them with "data-" then they are valid html5 as well.

See: http://ajaxian.com/archives/embed-your-data-in-html-5

Jeroen