How to disable button in an if condition

前端 未结 4 2136
我在风中等你
我在风中等你 2021-01-17 06:56

How do i disable a button if the prod_quantity == 0?



        
4条回答
  •  被撕碎了的回忆
    2021-01-17 07:11

    try this

    javascript onclick function...

    function addtocart(prod_qty){
        var quantity=parseInt(prod_qty);
        if (quantity == 0){
             document.getElementById("addtocartButton").disabled = true;   
        }
    
    }
    

    your button

    )" />
    

提交回复
热议问题