Home > Web Front-end > JS Tutorial > body text

How to remove classes in jquery

藏色散人
Release: 2021-11-17 10:55:11
Original
1819 people have browsed it

Jquery method to remove classes: 1. Create a new html file; 2. Create a new div and add a class class and text content; 3. Create a new button and add a click event; 4. Introduce the jQuery library; 5. Create Just remove the class event with one click.

How to remove classes in jquery

The operating environment of this article: Windows 7 system, jquery version 3.2.1, DELL G3 computer

How to remove the jquery class?

jQuery remove class:

Open the html editor and create a new html file. As shown in the figure

How to remove classes in jquery

Find

on the html code page and create a new
inside, then add a class class and text to this
Content, the class in the case is: remark. As shown in the picture

Code:

Going to have a big dinner tonight

How to remove classes in jquery

Create a new click button after

and add a click event to this button. In the case, the click event is: reClass(), which triggers the removal of the class style when clicked. As shown in the picture:

Code:

How to remove classes in jquery

## Set class style. Set a style for remark with a font size of 28px and a color of red. As shown in the picture:

Code:

<style>  .remark{   font-size: 28px;color: red;  } </style>
Copy after login

How to remove classes in jquery

Introducing the jQuery library. Introduce the jquery library after the