Wednesday, December 5, 2018

on click increment javascripot


<?php get_header(); ?>
<script type="text/javascript">
function burgersub(){
    if(document.getElementById("burg").value - 1 < 0)
    return;
    else
        document.getElementById("burg").value--;
}
function burgeradd(){
    var quantity = document.getElementById("quantity").value++;
    quantity++;
    var price = document.getElementById("price").value;
    alert(quantity);
    if (price) {
        document.getElementById("burg").value = price * quantity;
    }
}
</script>
<p><button class="btn btn-default" onclick="burgeradd()">+</button><button class="btn btn-default" onclick="burgersub()">-</button></p>
<input readonly="yes"  class="form-control" id="quantity" placeholder="Quantity">
<input readonly="yes"  class="form-control" id="burg" placeholder="Amount">
<input class="form-control" id="price" placeholder="Price">
<?php get_footer(); ?>

No comments:

Featured Post

Make money online

https://www.wpbeginner.com/beginners-guide/make-money-online/?fbclid=IwAR0_9_5aHmbB4rDisaPevdnO4uAgo0N9heHgPu1TjerjurE5ilD2NyzeB2A

Popular Posts