Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What you are trying to do is javascript and you cannot do it like that.</p> <p>When you get <code>&lt;span id="UP"&gt;0.00&lt;/span&gt;</code> you can also add that hidden element with that value, add <code>ID</code> to hidden elements` and modify your javascript function to add values to those hidden elements</p> <pre><code>&lt;script type="text/javascript"&gt; function showUP(str) { if (str==""){ document.getElementById("UP").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200){ document.getElementById("UP").innerHTML=xmlhttp.responseText; document.getElementById("UnitPrice").value=xmlhttp.responseText; } } xmlhttp.open("GET","getunitprice.php?q="+str,true); xmlhttp.send(); } function multiply(Quantity) { var totalPrice = parseFloat(document.getElementById("UP").innerHTML)*Quantity; document.getElementById("TP").innerHTML = totalPrice; document.getElementById("TotalPrice").value = totalPrice; } &lt;/script&gt; &lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;b&gt;UnitPrice: &lt;span id="UP"&gt;0.00&lt;/span&gt; &lt;/b&gt;&lt;input type="hidden" name="UnitPrice" id="UnitPrice" value=""/&gt;&lt;/div&gt;&lt;p&gt; &lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;b&gt;TotalPrice: &lt;span id="TP"&gt;0.00&lt;/span&gt; &lt;/b&gt;&lt;input type="hidden" name="TotalPrice" id="TotalPrice" value=""/&gt;&lt;/div&gt;&lt;p&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload