Adding, removing and checking if an element has a CSS class example

This is an example page for the post Adding, removing and checking if an element has a CSS class with jQuery on Chris Hope's LAMP Blog.

To use this example select the paragraph and class and then click the add, remove or has class buttons. "Add Class" will add the selected class to the selected paragraph, "Remove Class" will remove it, and "Has Class?" will pop an alert to tell you if it contains the class or not.

Paragraph 1: This text started off red.

Paragraph 2: This text started underlined.

Paragraph 3: This text started off bold.

Paragraph 1
Paragraph 2
Paragraph 3

Red
Underline
Bold