JQuery select input element by id and type - Javascript jQuery Selector

Javascript examples for jQuery Selector:id

Description

JQuery select input element by id and type

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-2.1.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){// www  . ja v  a 2s .c  o m
$(document).ready(function(){
    $('button').on('click', function(){
        console.log($('input[type=text][id=txtEditLoginName]').val());
    });
});
    });

      </script> 
 </head> 
 <body> 
  <input type="text" id="txtEditLoginName"> 
  <button>TEST</button>  
 </body>
</html>

Related Tutorials