<script> <br>//Modify the color style of the selected object to red <br>$("#btn2, .class1, span").css("color", "red"); <br></script>
Can be selected hierarchically, such as: $(".class1 div label")
111
222
< ;label>333
444
555
For example: $(".class1 span") or $(".class1").find("span")
< div id="id1">111
222
444
555
Select only from sub-layers, such as: $(".class1 > span"); If there is no middle >, all eligible descendant objects below it will be selected
111
222
444 555
followed by, such as: $("div span"); This will select everything immediately following the div span
111
222
444< ;br/> 555
At the same level (behind), such as: $("#id2 ~ *"); This is to select all (*) objects at the same level behind #id2
111
< div id="id2">222
444
555
Mixed use, such as: $( "#id3 label, #id3 ~ span")
111
222
< ;span>444
555
Select other elements at the same level, such as: $ ("#id2").siblings()
111
222
< span>444
555
Select other spans at the same level, such as: $( "#id2").siblings("span")
111
222
444
555
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