Peter -

To exclude something from an expression you can do something like:

$("div.oneclass:not(.thisclass)")

That'll find all the divs that have "oneclass" but not "thisclass".
Same works for IDs and such too:

$("div.oneclass:not(#someid)")

--John

On 11/1/06, Peter Mounce <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi
>
>
>
> Is there a "hasClass(cssClass, isHas)" function?  I want to do thing A to
> all elements of class X, and thing B to all elements that _don't_ have class
> X.  isHas would be a parameter that says hasClass or doesNotHaveClass.
>
>
>
> Eg:
>
>
>
>        var s = getState(linkId);
>
>        // rollovers and up/down events
>
>        var fnBlur = function() {
>
>               $(jqLinkId).removeClass("over");
>
>               return swapImageOnEvent(jqLinkId, s.Normal, s.Normal);
>
>        };
>
>        var fnFocus = function() {
>
>               $(jqLinkId).addClass("over");
>
>               return swapImageOnEvent(jqLinkId, s.Normal, s.Over);
>
>        };
>
>        var fnDown = function() {
>
>               $(".cb.sel").removeClass("sel");
>
>               $(jqLinkId).addClass("sel");
>
>               return swapImageOnEvent(jqLinkId, s.Normal, s.Sel);
>
>        };
>
>
>
>
>
> If the element that is being blur'd is the currently selected one (ie, it's
> been mousedown'd previously), I don't want the swapImageOnEvent call to
> happen.  I want to write something like:
>
>
>
> Var fnBlur = function() {
>
>   $(jqLinkId).removeClass("over");
>
>   If ($(jqLinkId).hasClass("sel", false)) {
>
>     Return swapImageOnEvent(jqLinkId, s.Normal, s.Normal);
>
>   }
>
>   Return false;
>
> };
>
>
>
> (Apologies for capitals and formatting if it screws up).
>
>
>
>
>
> Regards
>
> Peter Mounce
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
>


-- 
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to