Add a class to the first p element:
The addClass() method adds one or more classes to the selected elements.
This method does not remove existing class attributes, it only adds one or more values to the class attribute.
Tip: To add more than one class, separate the class names with space.
| Parameter | Description |
|---|---|
| class | Required. Specifies one or more class names to be added |
Using a function to add classes to selected elements.
| Parameter | Description |
|---|---|
| function(index,oldclass) | Required. Specifies a function that returns one or more class names to
be added.
|
Add two classes to an element
How to add two class names to a selected element.
Change the class of an element
How to use addClass() and removeClass() to remove one class, and add a new class.
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Best Hosting Coupons |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $3.98 Unlimited Hosting |
| Premium Website Design |
| WEB BUILDING |
|---|
| Download XML Editor |
| FREE Website BUILDER |
| Best Website Templates Top CSS Templates |
| CREATE HTML Websites |
| EASY WEBSITE BUILDER |
| W3SCHOOLS EXAMS |
|---|
|
Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
|
New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
|
Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|