Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to get input value on button click?
  2. <form accept-charset="UTF-8" id="form_id" action="/" method="post">
  3.   <input type="text" value="" placeholder="Email" name="fields_email" class="email_field">
  4.   <input type="submit" value="Subscribe" name="Subscribe" class="subscribe_btn">
  5. </form>
  6.        
  7. $('.subscribe_btn').click(function(e){
  8.   e.preventDefault();
  9.   console.log( $("#form_id .email_field").val() );        
  10. });
  11.        
  12. $('.subscribe_btn').click(function(e) {
  13.     e.preventDefault();
  14.  
  15.     alert($("#form_id .email_field").val());
  16.  
  17. });