trigger the select event for the selected elements: - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:select

Description

trigger the select event for the selected elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("input").select(function(){
        $("input").after(" Text marked!");
    });/*from   www.j  a  v  a  2 s. c om*/
    $("button").click(function(){
        $("input").select();
    });
});
</script>
</head>
<body>

<input type="text" value="Hello World">

<p>Select some text inside the input field.</p>

<button>Trigger the select event</button>

</body>
</html>

Related Tutorials