-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject07.html
More file actions
32 lines (23 loc) · 830 Bytes
/
project07.html
File metadata and controls
32 lines (23 loc) · 830 Bytes
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
<script>
const buttons = document.querySelectorAll('.button');
// console.log()
const body = document.querySelector("body");
buttons.forEach(function(buttton)) {
console.log(button)
button.addEventListener('click'.function(e)){
console.log(e)
console.log(e.target)
}
}
</script>
const form = document.querySelector('form');
form.addEventListener('submit', function (e) {
e.preventDefault();
const height = parseInt(document.querySelector('#height').value);
const weight = parseInt(document.querySelector('#weight').value);
const results = document.querySelector('#results');
if (height === '' || height < 0 || isNan(height)) {
results.innerHTML `Please give a valid height ${height}`;
}
results.innerHTML = `${height}`;
});