Raman Raman - 2 years ago 160
Javascript Question

add and remove multiple classes in jquery

I'm trying to add and remove multiple classes on a text field by clicking different radio buttons. I'm not able to remove the unwanted classes while switching between different radio buttons. My code for this is:

//For 1st radio button
if(actionUrl == "search-client-by-id")

//For 2nd radio button
else if(actionUrl == "search-client-by-name")


Answer Source

you can separate multiple classes with the space:

$("p").addClass("myClass yourClass");


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download