focus() function with function - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:focus

Description

focus() function with function

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://code.jquery.com/jquery-2.1.4.js"></script> 
 </head> //from  ww w  .j av  a  2 s  . c  om
 <body> 
  <input type="text" id="textid"> 
  <script>
      jQuery(function( $ ){ 
        $('#textid').focus(function() {
             console.log('Function is focused.');
        });
      });
    
      </script>  
 </body>
</html>

Related Tutorials