Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple mulch caculator won't fire on click and no error. jQuery and straigt js
    primarykey
    data
    text
    <p><strong>I'm attempting to convert a straight javacript function to fire with jQuery .click</strong></p> <p>I'm not getting any output errors yet it wont perform the calculation on jsfiddle.</p> <pre><code>var form = document.product_form_top; function process(v) { var value = parseInt(document.getElementById('item_qty').value); value += v; document.getElementById('item_qty').value = value.toFixed(0); } function calculate() { form.cubicYards.value = (form.length.value / 3) * (form.width.value / 3) * (form.depth.value / 35); document.getElementById('yards').innerHTML = finaloutput var number = parseFloat(form.item_qty.value); var finaloutput = number.toFixed(0); form.item_qty.value = form.cubicYards.value * 14.7; //calculate yards var number = parseFloat(form.cubicYards.value); var finaloutput = number.toFixed(0); document.getElementById('item_qty').innerHTML = finaloutput form.weightPounds.value = (form.length.value / 3) * (form.width.value / 3) * (form.depth.value * 21); form.weightPounds.value * 700; var number = parseFloat(form.weightPounds.value); var finaloutput = number.toFixed(0) document.getElementById('pounds').innerHTML = finaloutput } </code></pre> <p>Here's a jsfiddle <a href="http://jsfiddle.net/4L4St/8/" rel="nofollow">http://jsfiddle.net/4L4St/8/</a></p> <p>Here's a working version using onclick="calculate(); on a button to run the function. I would rather use jQuery's .click function to fire it. </p> <p><a href="http://spartonenterprises.com/store/playground-mulch" rel="nofollow">http://spartonenterprises.com/store/playground-mulch</a></p> <p>Also, I'm using toFixed(0) to remove the extra decimal points and it appears to work when inspecting with firebug, but the visible html shows the decimals. Strange? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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