jQuery support custom attributes, may be you can post a sample? Anyway, this works
$(document).ready(function(){ alert($("[custom='test']").length); }); <input type="text" id="text1" name="text1" custom="test" /> <input type="text" id="text2" name="text2" custom="test" /> <input type="text" id="text3" name="text3" custom="test" /> <input type="text" id="text4" name="text4" custom="test" /> On Aug 5, 10:04 am, Miket3 <miketro...@gmail.com> wrote: > 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.