jQuery Select Event Method

jQuery Select Event Method

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

ParameterDescription
FunctionIt 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

  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.

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

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