Why doesn't this script work? <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <span id="price_here" hidden="hidden">600</span><span id="sum_here">600</span> </button>◀<input type="number" value="1" onchange="check_qty($(this),1,100);" name="qty" id="qty" value="<? echo $qty ?>"></input>▶<button onclick="qplus('#qty', 100);" id="plus">^__i></button> <span id="sum_here1"></span>^__i id="mlus"> <script> $('#price_here').each(function() { this.textContent *= 2; }); function qminus(el, min) { var e = $(el); var compare = parseInt(e.val()); var i = ((compare - 1) < min) ? min : compare - 1; e.val(i); show_price(i); } function qplus(el, max) { var e = $(el); var compare = parseInt(e.val()); var i = ((compare + 1) > max) ? max : compare + 1; e.val(i); show_price(i); } function check_qty(el, min, max) { var compare = parseInt(el.val()); if (compare < min) { el.val(min); alert(min + ' is minimal qty'); } if (compare > max) { el.val(max); alert(max + ' is maximum qty'); } show_price1(el.val()); } function show_price(ch) { var sum = $('#price_here').html() * ch, coeff = +ch > 1 ? 0.02 : 0; $('#sum_here').html(sum * (1 - coeff)); $('#sum_here1').html(sum * coeff); } </script>
<script> $('#price_here').each(function() { this.textContent *= 2; }); function qminus(el, min) { var e = $(el); var compare = parseInt(e.val()); var i = ((compare - 1) < min) ? min : compare - 1; e.val(i); show_price(i); } function qplus(el, max) { var e = $(el); var compare = parseInt(e.val()); var i = ((compare + 1) > max) ? max : compare + 1; e.val(i); show_price(i); } function check_qty(el, min, max) { var compare = parseInt(el.val()); if (compare < min) { el.val(min); alert(min + ' is minimal qty'); } if (compare > max) { el.val(max); alert(max + ' is maximum qty'); } show_price1(el.val()); } function show_price(ch) { var sum = $('#price_here').html() * ch, coeff = +ch > 1 ? 0.02 : 0; $('#sum_here').html(sum * (1 - coeff)); $('#sum_here1').html(sum * coeff); } </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)