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
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to