Home >Web Front-end >JS Tutorial >How to select blocks and change attribute values ​​​​in jquery_jquery

How to select blocks and change attribute values ​​​​in jquery_jquery

WBOY
WBOYOriginal
2016-05-16 17:27:311000browse

jquery changes the value of the class attribute

Copy code The code is as follows:

$("#top_sta" ).removeClass().addClass("top_tab no_current");

1. First find the position of the div and p where the block is located

2. Remove the original class attribute, remove("***") means to remove *** in class, and remove() means to remove all values ​​in class.

Note: remove("") means to remove null characters, that is, no processing will be done to the class.

3.addclass("***"), add the string *** to class
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn