add and remove multiple classes in jquery
<p>hello 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:</p>

<pre><code>//for 1st radio button
if(actionUrl == "search-client-by-id")
{

    $("#req").removeClass("validate[required,custom[onlyLetterNumber],maxSize[20],custom[onlyLetterSp]]").addClass("validate[required,custom[onlyNumberSp]]");
}
//for 2nd radio button
else if(actionUrl == "search-client-by-name")
{

    $("#req").removeClass("validate[required,custom[onlyNumberSp]]").addClass("validate[required,custom[onlyLetterNumber],maxSize[20],custom[onlyLetterSp]]");
}
</code></pre>
