Skip to content
Related Articles

Related Articles

jQuery | select() with Examples
  • Last Updated : 13 Feb, 2019

The select() method is an inbuilt method in jQuery which is used when some letters or words are selected (or marked) in a text area or a text field.



Parameter: This method accepts single parameter function which is optional. Th function parameter will run after select method call.

Return Value: This method returns a notification when something is select.

Below example illustrates the select() method in jQuery:


<!DOCTYPE html>
        <title>Select Method</title>
        <script src=
        <!-- JQuery code to show the working of this method -->
            $(document).ready(function() {
                $("input").select(function() {
                    alert("Something was selected");
            div {
                width: 250px;
                height: 40px;
                padding: 20px;
                border: 2px solid green;
            <!-- select any thing from inside this field -->
            <input type="text" value="GeeksforGeeks!">

Before select anything !

After selecting some letters or words !


My Personal Notes arrow_drop_up
Recommended Articles
Page :