:selected Selector

Syntax

$(":selected")

Description

":selected" selector is used to select all the form elements of input type selected. The below example shows how to change the style of a selected element in a form using the :selected selector in JQuery.

Example Code

Result:


Click on Test and Pull down the drop-down menu to see the change in style of the selected item.


Nickname:
Password:
Country:
Accept Terms
Newsletter
Emails



Ask Questions

Ask Question