jQuery select event method; In this tutorial, you will learn what is jQuery select and how to use jQuery select event with selected html elements.
jQuery Select Event Method
The jQuery “select” event occurs when a user highlights text within a text field or textarea. This event is specific to the input field and textarea. When the “select” event occurs, you can associate a function to execute using the select() method.
Syntax of jQuery Select Event Method
$(selector).select()
It triggers a selected event for the selected elements.
$(selector).select(function)
Parameters of jQuery Select Event Method
Parameter | Description |
Function | It is an optional parameter. It is used to specify the function to run when the select event is executed. |
Example of jquery select event()
See the jquery select event method example; as shown below:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("input").select(function(){ alert("Text marked!"); }); }); </script> </head> <body> <input type="text" value="Hello World"> <p>Select some text inside the input field.</p> </body> </html>
Recommended jQuery Tutorials
- Jquery Click() Event Method with E.g.
- Event jQuery. Blur By Example
- jQuery form submit event with example
- keydown function jQuery
- List of jQuery Events Handling Methods with examples
- Jquery Selector by .class | name | #id | Elements
- How to Get the Current Page URL in jQuery
- jQuery Ajax Get() Method Example
- get radio button checked value jquery by id, name, class
- jQuery Set & Get innerWidth & innerHeight Of Html Elements
- jQuery Get Data Text, Id, Attribute Value By Example
- Set data attribute value jquery
- select multiple class in jquery
- How to Remove Attribute Of Html Elements In jQuery
- How to Checked Unchecked Checkbox Using jQuery
- jQuery removeClass & addClass On Button Click By E.g.