This article mainly introduces the usage of the selected selector in jQuery. The example analyzes the functions, definitions, and usage tips of the selected & lt; option & gt; element, for more information about the selected selector usage in jQuery, see the following example. Share it with you for your reference. The specific analysis is as follows:
This selector can match the selectedElement.
Syntax structure:
The Code is as follows:
$ (": Selected ")
This selector can be used with other selectors, such as class selectors and element selectors. For example:
The Code is as follows:
$ (". Myselect: selected" ).css ("color", "red ")
The code above can be used to selectThe text color in the element is set to red. You must pay attention to the above Code. The two selectors are separated by spaces. This is the descendant selector. If there is no space, it becomes a composite attribute selector, the code means that the class name is myselect andThe font color in the element is set to red.
Instance code:
The Code is as follows:
Foot home