Latest comments
- @VANIMEHTA@paolas771
Hello, you did a good job! Some tips
- their is a form attribute(<form></form>) that you can use instead of using a div for forms.
- When naming variable and functions, I would recommend using camelcase so it is easier to read for example firstName, lastName. So the first world starts with a lowercase and every word after that the first letter should be uppercase.
- As for the javascript they should be if else statements in all the validate functions so if(x === "") {....; return false} else {return true} otherwise it will always return true.
- you also want to do x == "" instead of x === " " in the if statements since the === compares data type as well.
- On the input type submit you want to change the onsubmit to onclick.
- In the css file on line 93 take away the .form-p class name that is what is causing the errors not to show.
- instead of using classList.toggle I would recommend using classList.add in the if statement and then add classList.remove in the else statement that way if the user makes more than one mistake it is not toggling back and forth every time they click the button.
- also add a event.preventDefault() in the validate() function so it is not reloading the page every time the user click the submit button. I hope this helps if anything is not clear let know so I can explain it better!!
Marked as helpful - @amosmachora@paolas771
Good job it looks great. You can add the box shadow using box-shadow css property. You add the amount you want on each side like you do margin and padding and then add a color at the end. Hope this helps!
- @Ali-Akbar-Qasimi@paolas771
Good Job on this challenge, there could be some improvements. When tip amount and total are given you want to round to two decimal places for a cleaner look you can do that by using variable.toFixed(2). Also instead of having event listener on the tip buttons you should do it on the number of people input so it will not give the user an infinity value.
- @treki@paolas771
You did a good job instead of having values in bill input and number of people input in JavaScript you should do placeholders in the html inputs so placeholder=“0” so when the user clicks on the inputs the number goes away and they do not have to delete themselves.
Marked as helpful - @johannesteshome@paolas771
Hello some of you math is wrong in the calculate function else statement. The billamounttotalperson should be the (tip amount + bill total) / number of people. What you are doing is taking the tip amount and multiplying it by 2 which there is no need. On the billamountperperson you should do (bill amount * tip value) / number of people. I would also recommend doing an event listener on the number of people input instead of the tip button just cause the user will be filling out the form from top to bottom. Other you did a good job!!
Marked as helpful - @Alucard2169@paolas771
Hello you did a good job. When using this page I’m assuming they are filling it out from top to bottom. To improve your site, instead of having an event listener on the tip buttons you can have it on the number of people input and have your calculate function in there so the user does not have to press the tip button again. So as soon as the user enters number of people the outputs are updated You could also make the number of people box the same size of the bill input box so it’s looks nicer.
Marked as helpful