How to add css class to a control using JQuery?

Options :
  1. $("divId").addClass("yourCSSClass");
  2. #cssClass("myDiv").add("className")
  3. addClass("#myDiv")
  4. class.add("yourCSSClass")
Answer and Explanation :-

Answer: Option 1

Explanation:

You can use addClass() function of JQuery to add css class to a control. for eg $("divId").addClass("yourCSSClass");

How do you rate this queston?  Very Easy  Easy  Average  Above Average  Tough

Previous Question : How to select an element using JQuery?

Next Question : How to remove css class using JQuery?

Click here for online test on JQuery

Responses


 (Getemail alerts when others member replies)

More available Categories:-








When love and hate are both absent, everything becomes clear and undisguised. Make the slightest distinction, however, and heaven and earth are set infinitely apart. If you wish to see the truth, then hold no opinions for or against anything. To set up what you like against what you dislike is the disease of the mind.
-Hsin Hsin Ming