OfficiallyYours
New Member
I had someone help me out and get this code.\[code\]<input type="hidden" id="charge_total" value="http://stackoverflow.com/questions/15592217/charge_total">\[/code\]And this JavaScript\[code\]<script>document.getElementById("charge_total").value = http://stackoverflow.com/questions/15592217/document.getElementById("system_cost").innerHTML;\[/code\]My problem is that it the host payment system I am using requires the hidden input to have a name.So the hidden input must be like this.\[code\]<input type="hidden" id="charge_total" name="charge_total" value="http://stackoverflow.com/questions/15592217/charge_total">\[/code\]My problem is using the code is it doesn't input any text into the field and I am left with a blank total in the check out page. I need this span ID to output whatever number it has into the hidden value input in this line of code.\[code\]<p>Total: <span id="system_cost"> </span></p><input type="hidden" id="charge_total" name="charge_total" value="http://stackoverflow.com/questions/15592217/charge_total">\[/code\]Anyone know what I did wrong? Here is how I put it in the header.\[code\]<script>$(function(){ //on document ready attach handlers$('form').on('submit', function(e){ e.preventDefault(); // stop the form submitting and do work $('#charge_total').val(parseFloat($('#system_cost').text())); $(this).submit(); //now submit the form, calculations are done});});</script>\[/code\]And these are the other two lines.\[code\]<input type="hidden" name="charge_total" value="http://stackoverflow.com/questions/15592217/charge_total"><p>Total: <span id="system_cost"> </span></p>\[/code\]The span shows on the page like it is suppose to and populates correctly. It's only the hidden value that just shows charge_total.