-
Notifications
You must be signed in to change notification settings - Fork 0
/
js.js
36 lines (27 loc) · 979 Bytes
/
js.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$(document).ready(function(){
$("#submit").click(() => {
let weight = Number($("#weight-input").val());
let height = Number($("#height-input").val());
if (weight < 1 || height < 0) {
alert("Check your inputs");
}
else {
let bmi = String(weight / (height * height)).split('.')[0];
if (bmi < 18){
var status = 'underweight';
document.getElementById("bmi-translation").style.color = red;
} else if (bmi < 26) {
var status = 'normal';
} else {
var status = 'overweight';
document.getElementById("bmi-translation").style.color = red;
}
document.getElementById("bmi-result").innerHTML = bmi;
document.getElementById("bmi-translation").innerHTML = status;
document.getElementById("notification").style.visibility = 'visible';
}
});
$("#back-notification").click(() => {
document.getElementById("notification").style.visibility = 'hidden';
});
});