Menu Close

Jquery :selected selector with example

Selected selector

Here, we will learn about :selected selector in jquery. The :selected selector is used to select the pre-selected item(s) in a drop-down list.



Follow the below example to learn about :selected selector in jquery.


<!DOCTYPE html>
<html lang="en">
    <title>Jquery :selected selector</title>
    <meta charset="utf-8">
    <script src=""></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">
             $(":selected").css("background-color", "#009933");
        .select-style {
            text-align: left;
    <div class="select-style">
        Name: <input type="text" name="user"><br><br>
            <option selected="selected">Fruits</option>
Posted in jQuery, Web Technologies

You can also read...