Getting input values from tables with jQuery -


right now, html code looks so:

<div id="register"> <table class="tab2">         <tr>             <td>email:</td>             <td><input type="text" id="email" /></td>         </tr>         <tr>             <td>confirm email:</td>             <td><input type="text" id="confirmemail" /></td>         </tr> </table> </div> 

and values inputs via jquery, have this:

$("#email").live('focusout', function() {     email = $(this).val(); }); $("#confirmemail").live('focusout', function() {     confirmemail = $(this).val(); }); 

i know there better solutions perform (as solution works, messy since there's way more 2 inputs), won't work me. i'd use like

$("#email").val(); 

and retrieve value it's needed, rather storing variable. issue whenever run code, returns empty string. reason that?

edit:

i forgot mention values being used after click event ran, so:

$("#dialog_next").live('click', function() { 

when run $("#email").val() code after that, returns empty string.

update: fiddle works fine: http://jsfiddle.net/yt8pk/

i expect issue has when code run. since can't see problem code can guess. example if had this:

 $(function () {      var email = $("#email").val();       function string getemail() {         return email;      }       ... (later call getemail @ value)   }); 

it fail variable email set before user input.

code work:

 $(function () {       function string getemail() {         var email = $("#email").val();         return email;      }       ... (later call getemail @ value)   }); 

what did code failed like?


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -