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> Link to comment https://forums.phpfreaks.com/topic/257423-adding-textbox-values-together-for-the-total/ 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/ Link to comment https://forums.phpfreaks.com/topic/257423-adding-textbox-values-together-for-the-total/#findComment-1319611 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! Link to comment https://forums.phpfreaks.com/topic/257423-adding-textbox-values-together-for-the-total/#findComment-1319944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.