UNPKG

bmi-calculator

Version:

Bmi calculator for jQuery

32 lines (26 loc) 1.04 kB
/* NOTICE: * BMI should not be used as the only calculation for body mass, because of inaccuracy! * * BMI does not take into account other factors which may affect a persons height or weight: Body builders and athletes with a high proportion of muscle mass. The elderly (whose height and muscle mass may fall over time), frail people, and those affected by certain illnesses. Lactating or pregnant women. Children and teenagers who have not reached physical maturity and are still growing. A tendency for natural differences in height and weight ratios between races.*/ $(function() { $("#bmi-calculator").bmi({ ajax: { dataType: "JSON", dataUrl: "index.html" }, colorTransition: "0.3", debug: true }); $("#bmi-calculator input[type=number]").on("keydown", function(e) { if(!((e.keyCode > 95 && e.keyCode < 106) || (e.keyCode > 47 && e.keyCode < 58) || e.keyCode === 8)) { return false; } }); });