Home  >  Article  >  Web Front-end  >  In jQuery: Selected selector usage example

In jQuery: Selected selector usage example

PHPz
PHPzOriginal
2016-05-16 16:22:181749browse

This article mainly introduces the usage of selected selector in jQuery, and analyzes the function and definition of selected selector and the usage skills of matching selected 5a07473c87748fb1bf73f23d45547ab8 elements. Friends who need it can refer to it

The example in this article describes the usage of:selected selector in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This selector can match the selected 5a07473c87748fb1bf73f23d45547ab8 element.

Grammar structure:

$(":selected")

This selector can be used in conjunction with other selectors, such as class selectors, element selectors, etc. wait. For example:

$(".myselect :selected").css("color","red")

The above code can set the text color in the selected 5a07473c87748fb1bf73f23d45547ab8 element under the element named myselect to red. Everyone must pay attention to the above code. The two selectors are separated by spaces. At this time, it is the descendant selector. If there are no spaces, it becomes a composite attribute selector, and the meaning of the code becomes the class name. is myselect and the font color in the selected 5a07473c87748fb1bf73f23d45547ab8 element is set to red.

Example code:






脚本之家




The above is the entire content of this chapter. I hope it will be helpful to everyone’s jQuery programming. , for more related tutorials, please visit jQuery Video Tutorial!

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