Home >Web Front-end >JS Tutorial >Explanation of the role of the jQuery greater than sign (>) selector_jquery

Explanation of the role of the jQuery greater than sign (>) selector_jquery

WBOY
WBOYOriginal
2016-05-16 16:20:281364browse

What is the role of the greater than sign in jQuery selector>:
jQuery's flexible and diverse selectors are one of the advantages of jQuery.
Let's introduce one of the selectors, represented by the greater than sign.
The code example is as follows:

Copy code The code is as follows:





Ant Tribe


<script><br> $(document).ready(function(){<br> $("#box>div").css("background-color","green");<br> });<br> </script>









The above code can set the background color of the first-level div sub-element under the box element to green.
That is to say, the selector matches the first-level child elements of the specified element, not all descendant elements.

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