Manipulating Class Names (^) ❘ 101
In the JavaScript created for Example 4-2, you attach four events to each of the four
element. jQuery adds only this class name once; if it is already present, nothing happens.
The addClass() method can take one or more class names. If you want to add multiple class names,
a space character should separate each class name.
$('button#documentAddClass').click(
function(event)
{
event.preventDefault();
$('table').addClass('johnLennonAlbums');
}
);
The hasClass() method, demonstrated by the event attached to the second