Add event handler for input text element onblur event in JavaScript
Description
The following code shows how to add event handler for input text element onblur event.
Example
<!-- ww w. jav a 2 s. c om-->
<html>
<head>
<title></title>
<script type="text/javascript">
window.onload=setObjects;
function setObjects() {
document.personData.firstName.onblur=testValue;
}
function testValue() {
document.write(this.value);
}
</script>
</head>
<body>
<form name="personData">
First Name: <input type="text" name="firstName" />
</form>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Focus Event
Listen to Focus Lost event for input passwo...
Add event handler for input text element on...
Add event listener to input text focus on e...Listen to Focus Lost event for input passwo...