revision:
The onselect event occurs after some text has been selected in an element.
The onselect event is mostly used on <input type="text"> or <textarea> elements.
<element onselect="script"></element >
script: the script to be run on onselect.
example
Select some of the text:
codes:
<p class="spec">Select some of the text: <input type="text"
value="Hello world!"
onselect="selectFunction()"></p>
<script>
function selectFunction() {
alert("You selected some text!");
}
</script>
example
Select some text:
codes:
<p class="spec">Select some text: <input type="text" value="Hello world!" onselect="selectText()"></p>
<p class="spec" id="demo-bb"></p>
<script>
function selectText() {
document.getElementById("demo-bb").innerHTML = "You selected
some text!";
}
</script>