input select event function - Javascript jQuery

Javascript examples for jQuery:Form Input

Description

input select event function

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
  <script>
$(function(){//from w w w  .  j a  va  2s. c  om
  $("input").on('select', function(e) {
    e.preventDefault();
    $(this).after("Text selected ");
  });
  $("button").click(function(){
     $("input").select();
  });
});

      </script> 
 </head> 
 <body> 
  <input type="text" name="FirstName" value="Hello World"> 
  <br> 
  <button>Trigger select event</button>  
 </body>
</html>

Related Tutorials