Let's say I have some elements with similar-looking classes on them, like
.HiliteUp and .HiliteDown, and I want to remove them. This works:

$("input").removeClass("Hilite(Up|Down)");

Should jQuery be documented to make this kind of usage official? It is
depending on implementation details (that is, removeClass uses a RegExp) but
it sure is handy so I would vote "feature".

One level of backslashes is removed when the string is processed so you need
to double them up. For example this would remove any class name starting
with Hilite followed by letters, digits, and underscores:

$("input").removeClass("Hilite\\w+");

And .removeClass(".*") is the same as .attr("className","") but should be
saved for the First Annual Obfuscated jQuery Contest.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to