jquery - How to get input value on button click? -



jquery - How to get input value on button click? -

here form code:

<form accept-charset="utf-8" id="form_id" action="/" method="post"> <input type="text" value="" placeholder="email" name="fields_email" class="email_field"> <input type="submit" value="subscribe" name="subscribe" class="subscribe_btn"> </form>

js file :

$('.subscribe_btn').click(function(e){ e.preventdefault(); console.log( $("#form_id .email_field").val() ); });

how live input value? on click i'm getting old value not live....

thank you, dmitry

works me:

$('.subscribe_btn').click(function(e) { e.preventdefault(); alert($("#form_id .email_field").val()); });

http://jsfiddle.net/rhqc7/

i changed console alert(), tested in both ff9.0.1, ie8, chrome 16.0.x

jquery

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -