JavaScript onselect Event function

javascript JavaScript onselect Event function Javascript And Functions

How to write and call the onselect function in JavaScript?

We mostly call the on select function with <input> and <textarea> HTML tag . • Now we are going to use HTML tag <input> . • On select the data we will call "alertfunction() " function .

<input id="myinput" onselect="alertfunction()">

How to call a function on select the text of <input> and alert a message using JavaScript alert() function?

Output of onselect calling function

Full Source Code of onselect calling JavaScript function

<input value="Hello , Welcome to CodingPk !" onselect="alertfunction()"> <script type="text/javascript"> function alertfunction() { alert("You have selected Some Text from Input field"); } </script>
javascript Javascript And Functions Chapter Next »