hello friends i have just a short question.
i want to make i calculator in avascript to change the value a html field in real time i have my script before the html body tag close
function calculTarif()
{
var prix = parseFloat($("#prix").val());
var poid = parseFloat($("#poid").val());
var total;
if (poid<3){
total = (prix * poid);
}
else {
total = 35;
}
$("#tarif").val(parseFloat(total).toFixed(2));
}
$("#poid").change(function() {
calculTarif();
});
calculTarif();
</script>
and here is the form
<form name="tarif" method="post" action="">
<label for="poid">Poid</label>
<input type="text" name="poid" id="poid">
<input type="hidden" name="prix" id="prix">
<label for="tarif">tarif</label>
<input type="text" name="tarif2" id="tarif">
</form>
</section>
i have done all the job but it is not working i don't what is wrong i'm not expert in javascript