JavaScript Tutorial

adplus-dvertising
Onchange event In JavaScript
Previous Home Next

Onchange event in javascript is used for change text and all . manely its show the change at click event .

Syntax :

 < select onchange="myFunction()">

Example :

<html>
<body>

<p>This example is show the onchange event in javascript</p>

Enter your name: <input type="text"
 id="fname" >

<p>when you enter your name in
 captical letter and press the enter button you wiil got letter become smaller </p>

<script>
document.getElementById(
"fname").onchange = function() {myFunction()};

function myFunction() {
    var x = 
	document.getElementById("fname");
    x.value = x.value.toLowerCase();
}
</script>

</body>
</html>

Output :

Previous Home Next