get input text value with jquery - Javascript jQuery

Javascript examples for jQuery:Form Text Input

Description

get input text value with jquery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 </head> /*www .  j  a v  a2 s  .  c o  m*/
 <body> 
  <div id="content"> 
   <input type="text" id="textfield"> 
   <button type="button" id="btn" onclick="go()">Go</button> 
  </div> 
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
  <script type="text/javascript">
function go()
{
    console.log($("#textfield").val());
}

      </script>  
 </body>
</html>

Related Tutorials