jQuery Select Events by -Examples

jQuery Select Events by -Examples

Learn jquery select() event by example. We will take the example of a jquery select event.

jQuery select()

The select event occurs when a text is selected (marked) in the text field or text field. This event is limited to the field and box. When the select occurs, the select() method encloses a function to run.

Syntax

$(selector).select()  

It triggers a selected event for the selected elements.

$(selector).select(function)  

Parameters of jQuery select() event

ParameterDescription
FunctionIt is an optional parameter. It is used to specify the function to run when the select event is executed.

Let’s see example of jquery select event()

<!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>

You may like

  1. Jquery Click() Event Method with E.g.
  2. Event jQuery. Blur By Example
  3. jQuery form submit event with example
  4. keydown function jQuery
  5. List of jQuery Events Handling Methods with examples
  6. Jquery Selector by .class | name | #id | Elements
  7. How to Get the Current Page URL in jQuery
  8. jQuery Ajax Get() Method Example
  9. get radio button checked value jquery by id, name, class
  10. jQuery Set & Get innerWidth & innerHeight Of Html Elements
  11. jQuery Get Data Text, Id, Attribute Value By Example
  12. Set data attribute value jquery
  13. select multiple class in jquery
  14. How to Remove Attribute Of Html Elements In jQuery
  15. How to Checked Unchecked Checkbox Using jQuery
  16. jQuery removeClass & addClass On Button Click By E.g.

Leave a Reply

Your email address will not be published. Required fields are marked *