Get text box id when entering the value in text box using javascript - Javascript jQuery

Javascript examples for jQuery:Text

Description

Get text box id when entering the value in text box using javascript

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
  <script type="text/javascript">
    $(function(){//from w  ww  . j av  a 2s.  c om
$('input[type=text]').on('input',function(){
   console.log($(this).attr('id'));
});
    });

      </script> 
 </head> 
 <body> 
  <input type="text" id="input1"> 
  <input type="text" id="input2"> 
  <input type="text" id="input3">  
 </body>
</html>

Related Tutorials