Listen to Focus Lost event for input password in JavaScript

Description

The following code shows how to listen to Focus Lost event for input password.

Example


<html>
<head>
<script type="text/javascript">
  function checkRequired() {<!--from   w  ww  . j a v a  2 s. com-->
    document.write("value is required in field");
  }
</script>
</head>
<body>
  <form name="someForm">
    <input type="text" name="text1" /><br /> 
    <input type="password" name="text2" onblur='checkRequired();'/><br /> 
    <input type="hidden" name="text3" value="hidden value" />
    <textarea name="text4" cols=50 rows=10>The text area</textarea>
    <input type="submit" value="Submit" />
  </form>
</body>
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window