Skip to content Skip to sidebar Skip to footer

Remove Class Not Working With Mootools

I'm using the following piece of code in my webpage to change the class of select elements depending on the choice of a radio button. The part where I add the class works fine but

Solution 1:

It doesn't work because the MooTools ".removeClass()" method simple-mindedly jams the class name into the middle of a regex without bothering to escape embedded regex meta-characters.

You can, however, work around the problem by doing the appropriate quoting yourself. In this example, it'd look like this:

 $('first_name_conjoint').removeClass("validate\\['required','nodigit'\\]");

Here is a jsfiddle.


Post a Comment for "Remove Class Not Working With Mootools"