How to Add class to our controls dynamically?

 Posted by vishalneeraj-24503 on 1/3/2015 | Category: jQuery Interview questions | Views: 774 | Points: 40
Answer:

addClass is an in-built jQuery method,which is used for adding class dynamically.We have to pass class name in this addClass method.
Syntax:-
addClass(our_className);

For Example:-
<script src = "//code.jquery.com/jquery-1.10.2.js"></script>

$("p").addClass("our_className");

Now,write your own class,and replace with our_className.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response