Amal Karim ✅• 1,290
@amalkarim
Posted
Hi Albert. Maybe this can help.
There's an error in this line:
const text = document.querySelector('text');
It doesn't select class text
, but select text
element which is nowhere to find. Let's repair this first.
const text = document.querySelector('.text');
Then we need to change function setPeopleValue()
. Check out the code below:
function setPeopleValue() {
peopleValue = parseFloat(inputPeople.value);
if (isNaN(peopleValue)) peopleValue = 0;
if (peopleValue < 1) {
text.classList.remove('hidden');
} else {
text.classList.add('hidden');
calculateTip();
}
}
Let me know if there's still error. Happy coding!
Marked as helpful
0
Albert Rex• 360
@rexalbert538
Posted
@amalkarim thank you so much
0