Skip to main content

Posts

Showing posts with the label class-attributes

How do you remove a class that matches a pattern from the class attribute, but retain the other classes?

I want to delete the classes that end with 'blue' from the class attribute on all tags sample html <p class="text_blue happy">this is blue text</p> <p class="text_red nothappy">this is red text</p> <img class="img_blue nothappy" /> This will give me all the elements with classes that end with 'blue' $('[class$=blue]'); how do I pop these matched classnames off of the class attribute?