JavaScript Tutorial

focus

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>focus demo</title>
  <style>
  span {
    display: none;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
    <p><input type="text"> <span>focus fire</span></p>
    <p><input type="password"> <span>focus fire</span></p>
    <script>
        $( "input" ).focus(function() {
            $( this ).next( "span" ).css( "display", "inline" ).fadeOut( 1000 );
        });
    </script>
</body>
</html>