es131245 Posted September 3, 2012 Share Posted September 3, 2012 (edited) Im writing a digit (bin-dex-hex) converter on jqueryHTML source looks like <table class="digits"> <tr><th>number system</th><th>digit</th></tr> <tr><td>2 (bin)</td><td><textarea id="bin">10000</textarea></td></tr> <tr><td>10 (dex)</td><td><textarea id="dex">16</textarea></td></tr> <tr><td>16 (hex)</td><td><textarea id="hex">f</textarea></td></tr> </table> <script type="text/javascript"> // code here </script> Idea is to use .keyup on jquery to conver digits when key is upand Ive begun to write jquery part but came across a problem strate away.Few experiments helped me to figger out what is wrong.This will explain the problem <script type="text/javascript"> $("textarea#bin").bind('keyup',function(){alert($("textarea#bin").innerHTML());}); </script> When i change binary digit jquery still alerts 10000. It "memorizes" first (default) digit.How can I make jquery "update" textarea values? Edited September 3, 2012 by es131245 Link to comment Share on other sites More sharing options...
Ingolme Posted September 3, 2012 Share Posted September 3, 2012 You need to use the value property of the textarea, rather than the innerHTML. I think jQuery uses .val() for that. Link to comment Share on other sites More sharing options...
es131245 Posted September 4, 2012 Author Share Posted September 4, 2012 ow! val() worked! so value wasnt a good ideathank you! You always getting everything to work! Link to comment Share on other sites More sharing options...
Ingolme Posted September 4, 2012 Share Posted September 4, 2012 Just a correction: 16 in hexadecimal is 10, not F. Link to comment Share on other sites More sharing options...
es131245 Posted September 5, 2012 Author Share Posted September 5, 2012 (edited) Just a correction: 16 in hexadecimal is 10, not F.working converter gives out the same Edited September 5, 2012 by es131245 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now