Onselect event In Java Script

This event gets fired when user selects text in a textbox or text field. A text field contains text and we can select that text but when we select text of a text field onselect event gets fired.


<title>events </title>


<body bgcolor=blue text=”white” >

<form name=”sandeep” onselect=”alert(‘hi’)”>

Name : <input type=”text” name=t1 id=”tt1″ > <br>

Address : <input type=”text” name=t2 > <br>

Educational Qualification :


<option> 10th

<option> 12th

<option> Graduate

<option> Post Graduate

<option> PhD


Comments :<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<textarea rows=5 onselect=”alert(‘yes delete this selected text’)”>

You can type this text and type your comments here




function ff()


alert(“The value being set is ” +document.all.tt1.value)





Scroll to Top