2007/8/16, Glen Lipka <[EMAIL PROTECTED]>:
>
> As a non-programmer, (HTML/CSS only) I understand lt() and gt() mainly
> because of &lt; and &gt;.
> I think those are very easy.  The place I get confused a little is when
> you can say $("p:gt(4)") and $("p").gt(4) and get the same thing.  Why
> both?  I suppose the answer is "because some people like it one way and some
> the other".


I like this methods and I'm using them a lot. They are very handful when I
must to do some operation on subset of elements:

$("p:gt(4)").show().gt(10).css("color","red");

Or, if you need to operate multiple time on same collection:

var my_coll = $("p");
my_coll.gt(3).css("color","red");
my_coll.lt(3).css("color","blue");

This stuff cannot be done by solely in selector expression.

-- 
Dragan Krstić krdr
http://krdr.ebloggy.com/

Reply via email to