slyte33 Posted February 21, 2012 Share Posted February 21, 2012 Hello, I am having trouble with getting the total of the value of the two text fields(labeled price1, price2). If anyone could help me add them that'd be greatly appreciated, thanks <script> function price(sum,val) { e = document.getElementById(sum); document.getElementById(val).innerHTML = e.value; } </script> Amount: <input type="text" id="price1" value="0" onkeyup="price('price1','price1_price')"> <b>First Price</b> $<span id="price1_price">0</span><br> Amount: <input type="text" id="price2" value="0" onkeyup="price('price2','price2_price')"> <b>Second Price</b> $<span id="price2_price">0</span> Quote Link to comment Share on other sites More sharing options...
scootstah Posted February 21, 2012 Share Posted February 21, 2012 Your code is a little confusing, but I think this is what you wanted: http://jsfiddle.net/pkvsq/ Quote Link to comment Share on other sites More sharing options...
slyte33 Posted February 22, 2012 Author Share Posted February 22, 2012 Your code is a little confusing, but I think this is what you wanted: http://jsfiddle.net/pkvsq/ Exactly what I was looking for, thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.