How to remove the same level class in Jquery
jquery
Jquery method to remove the same level class: 1. Use the "$(".Element class name")" statement to obtain the object according to the specified class value; 2. Use the removeClass() method to remove the class of the element , the syntax is "element object.removeClass('element class name')".
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.
How to remove the same class with Jquery
1. Open the html editor and create a new html file. Find
on the html code page and create a new in it, and then add a class and text content to this
. The class in the case is: remark.
<div class="remark">今晚要去吃大餐</div>
Copy after login
Create a new click button behind
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.
<input type="button" value="移除class" onclick="reClass()">
Copy after login
Set class style. Set a style for remark with a font size of 28px and a color of red.
<style> .remark{ font-size: 28px;color: red; } </style>
Copy after login
The code is as follows:
2. Introduce the jQuery library. Introduce the jquery library after the