With Jake Query we can add class attribute to different elements.
We can select single or multiple elements to apply the class to in this example.
We have a couple of headings in three lines of text by clicking the add class button we trigger an event
that changes all the text to read text line three also increases in size.
Let's take a look at the code to see how it works.
First we can see in our body that we have two heading tags H1 and H2.
We also have a two paragraph tags each containing a line of text the div element contains a third line
of text.
Lastly we have our button element
our style sheet has two classes one named big and the other red
the big class will change the font weight to bold in size to extra large the red class will change the
text color to red neither of these classes have been used yet
in our script tags.
We've created a quick event on the button the Click event triggers our add class method which adds the
class red to any H1 H2 and P elements on the page a second add class method is created to add multiple
classes both big and red to any div elements on the page
and that's how this script works.
So if we refresh the page and just go through it once more when we click the Add class button we can
see all the text color changes to red and text line three becomes bold and font size of extra large.