What happens with custom attributes regarding the strict XHTML format?

----- Original Message ----- From: "Rick Faircloth" <r...@whitestonemedia.com>
To: <jquery-en@googlegroups.com>
Sent: Wednesday, August 05, 2009 5:12 AM
Subject: [jQuery] Re: Custom Attributes - Beginner tip



Thanks for the tip!

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Miket3
Sent: Tuesday, August 04, 2009 8:04 PM
To: jQuery (English)
Subject: [jQuery] Custom Attributes - Beginner tip


One issue I ran across while learning jquery was that I often wanted/
needed a way to tell jquery to get data for the current element from a
related element. jQuery immediately tends to be friendly when you need
to work with a class of elements via the CLASS attribute, or a
specific element via the ID attribute. However, when there are 2
elements that are related but do not fit within a class, a beginner
such as myself may have a little trouble trying to find the best way
to handle this issue. At this point we begin to research how to get
jQuery to recognize a custom attribute, because common rules says that
the ID attrib is basically out of the question as this needs to be
unique to each element. And the CLASS attrib just doesn't logically
help either because it can refer to too many other elements that don't
fit our rule. And when we find out that jQuery doesn't readily
recognize custom attributes it can get a little intimidating because
one of the solutions is to extend jQuery.  But there are a couple of
other standard attributes that are recognized but rarely used.  In my
particular case I started using the TITLE attribute for relating my
elements. But then I stumbled upon the correct way, (or at least until
someone corrects me on this post).  There is a REL attribute which can
be used to RELATE the to elements.  So when you feel like you need a
custom attribute, you might not need one, the REL is available and the
TITLE could be used as a backup if necessary.

I hope this helps someone.

Reply via email to