[Solved] How to calculate a total price JS


Add a simple check for zero (exception handling for divide by zero). Replace the below line:

$("#article_ammount").val(article_price * article_cant / article_discount)

With something like this:

if (article_discount != 0)
  $("#article_ammount").val(article_price * article_cant / article_discount)
else
  $("#article_ammount").val(article_price * article_cant)

14

solved How to calculate a total price JS