Design comparison
Solution retrospective
Guys, i have 2 problems, 1- I don't know to to change the font style to Poppins 2- when I enter the date the output doesn't last maybe 2sec
Community feedback
- Account deleted
Hi !
for the second problem try this:
the last line of script.js
btn.addEventListener("click", calculateAge);
change it tobtn.addEventListener("click",(e) => {
e.preventDefault();
calculateAge();
});
Marked as helpful0@JoeatefgharibPosted about 1 year ago@DoctorLoo ty can you explain to me what e.preventDefault(); means also the (e) part Why can't I just put it like before?
1Account deleted@Joeatefgharib because you but you button inside form tag the default behavior is to send the data into an exciting server on submitting with your code you will see the data sent on the URL and reload the page that is why the fields fades away, and the e is the event which is submitting try to remove the form tag and replace it with div and make your button listener like before see if it works .
Marked as helpful1 - Account deleted
And for the first problem try to put the font on tailwind.config.js file
0 - @AsilvazavalaPosted about 1 year ago
Hi, for the first problem, you have to go to google fonts and search Poppins, download 400 and 700i, copy the link for your html file and paste, seems like this:
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,500;0,600;0,700;1,600;1,700&display=swap" rel="stylesheet">Then you can use the font
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord