<html>
<body>
<p>This example uses the addEventListener() method to attach a "select" event to an input element.</p>
Select some text: <input type="text" value="Hello world!" id="myText">
<p id="demo"></p>
<script>
document.getElementById("myText").addEventListener("select", myFunction);
function myFunction() {
document.getElementById("demo").innerHTML = "You selected some text!";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onselect_addeventlistener by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:40:04 GMT -->
</html>