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<div class="remark">今晚要去吃大餐</div>
Create a new click button behind
<input type="button" value="移除class" onclick="reClass()">
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>
The code is as follows:
2. Introduce the jQuery library. Introduce the jquery library after the