Introduction:

  • In this article we will explain how to select input box value in jquery or What is select() method in jquery
  • or why use select() method in jquery with example.


Description:

jQuery select event occurs when a text is marked or selected in text area or a text field. This event is limited to <input type="text"> fields and <textarea> boxes.

Syntax:

  • $(selector).select();

  • Example of jQuery select() method


Let's take an example to demonstrate jQuery select() Method.

<!DOCTYPE html>
<html>
<head>
 
    <script src="Scripts/jquery-1.8.2.min.js"></script>
    <script>
        $(document).ready(function () {
            $(":input").select(function () {
                $("div").text($(this).val()+' text was Selected').show().fadeOut(2000);
            });
        });
    </script>
</head>
<body>
    <input  type="text"/>
    <div></div>
</body>
</html> 

Output:


How to use select event in jquery


In above example when we select input box value then call select() method and show message


sqltutorialspoint text was Selected”. 

 

 

I hope this article will help to you.

 

 

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

you may also like