Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have functions in your increment.js script that change the value of the input after you get them in "myfuntion". You need to calculate the prices after the values are changed.</p> <p>So first you should <strong>remove</strong> the lines below from this file: </p> <p><a href="http://alpha.kentishtours.co.uk/assets/scripts/increment.js" rel="nofollow">http://alpha.kentishtours.co.uk/assets/scripts/increment.js</a></p> <pre><code>$("#increase").click(function(){ var $n = $("#adult"); $n.val(Number($n.val())+1); }); $("#decrease").click(function(){ var $n = $("#adult"); $n.val(Number($n.val())-1); }); $("#increasec").click(function(){ var $n = $("#child"); $n.val(Number($n.val())+1); }); $("#decreasec").click(function(){ var $n = $("#child"); $n.val(Number($n.val())-1); }); </code></pre> <p>Also remove the <code>onClick="myFunction()"</code> attribute in your HTML form.</p> <p>Then change all your myFunction script to this:</p> <pre><code>var adult = $('#adult'), child = $('#child'), total = $('#total'), value = $('#value'), increase = $('#increase'), decrease = $('#decrease'), increasec = $('#increasec'), decreasec = $('#decreasec'); var calulate_price = function(a, c){ var p1 = 39, p2 = 30, PA = a * p1, PC, d; if(a &gt;= 1) PC = c * p2; else PC = c * p1; d = PA + PC; total.text(d); value.val(d); }; increase.click(function(){ var a = Number(adult.val()); var c = Number(child.val()); adult.val(++a); calulate_price(a, c); }); decrease.click(function(){ var a = Number(adult.val()); var c = Number(child.val()); adult.val(--a); calulate_price(a, c); }); increasec.click(function(){ var a = Number(adult.val()); var c = Number(child.val()); child.val(++c); calulate_price(a, c); }); decreasec.click(function(){ var a = Number(adult.val()); var c = Number(child.val()); child.val(--c); calulate_price(a, c); }); </code></pre> <p>Everything working: <a href="http://jsbin.com/ohUniCa/2/edit?js,output" rel="nofollow">http://jsbin.com/ohUniCa/2/edit?js,output</a></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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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