I am getting a typeError on the if statement for validating the day, can anyone help me fix the issue?
alirs07
@alirs07All comments
- @waru-guruSubmitted 9 months ago@alirs07Posted 9 months ago
Hi there. Good job. you declared the enter_day id in your index.js file as date, but the day input id is day. That's the typeEfrror reason.
HTML:
<input type="number" placeholder="DD" id="day">
JS:const enter_day = document.getElementById("date");
0 - @JonathanbeesSubmitted 10 months ago
Issues during the creation of this challenge
Distribution of buttons
-
Create each button (the 5 circles of the rate) was so difficult especcially because i was changing sometimes the HTML elements, for example, at the beggining i create these with only div division, then, searching, i found that is easier to create input and label elements to just hide the input elements and work with the label elements, but at least i learn a little more about html forms :)
-
i didn´t find the way to put the 5 circles and the button at the same time thinking about how can i do to validate that the input element needs to be selected before pressing the button to show the next section, i appreciate if anyone can advice me about it, this will help me a lot
Javascript functionalities
-
First of all, during the creation of the click function to change the color of the selected circle i was a little confused of how can i pick all of the 5 items without having a id or a class according to each of these (in the code i let some of my attempts to recreate that function seeing that all of that was true :3)
-
then, i don´t understand so much of how can i collect the information of the button (the number) that was pressed, after a few attemps, i found that the method: stringify() can help me with that and then, just transform my string into a char with just a chartAt method
-
Finally, i understand that i can just add or remove classes (like the click function) to hide or show the part that is interesting to me, in this case, the thanks section once i press the submit button, i also learn a little of how to create HTML elements with javascript to push them in the section that i needed
Learnings during the developing of this challenge
-
I learn a lot more about some CSS elements, i hope that one day i will do it more mechanically :), it´s obvious that i need to learn a lot more, and maybe in this challenge the code it´s not the better optimized, but it´s an attemp, i need to learn more about specially in the responsive design, because i don´t understand a lot of how to do that, i will be very gratefull if someone can give me some advices according to this
-
I learn a little more about javascript DOM manipulation, it´s a long way to understand all the javascript that i want to learn, but one step a time, if you read this, if you can give me advices of my distribution of my javascript code to improve it, or explain me of how could i resolve the issues that i had, i´ll be very grateful :3
@alirs07Posted 10 months agoHi. User can select multiple options, you can fix that by simply adding the name attribute with the same values to the inputs.
To validate if any input is selected I did this: I declared a variable with the value of 0, then with a forEach method check if any input is selected then change the variable value to input value.
Hope that helps you!
Marked as helpful2 -
- @Kaushik1210Submitted 11 months ago@alirs07Posted 11 months ago
Hey there! your app shows an error message on invalid inputs but still does the calculation.
0