The function myFunction() is triggered when some text is selected in the input field. The function shows a message.
<!DOCTYPE html>
<html>
<body>
Some text: <input type="text" value="Select me!!" onselect="myFunction()">
<p>The function myFunction() is triggered when some text is selected in the input field. The function shows a message.</p>
<script>
function myFunction() {
alert("You have selected some text!");
}
</script>
</body>
</html>
Type: | html |
Category: | Web Tutorial |
Sub Category: | HTML Form Events Attribute |
Uploaded by: | Admin |