@deepak-parmar
Posted
@Arslanj9,
-
Your path to
main.js
is not working, remove/
from the beginning of it. It should be justjs/main.js
or add.
in front on it for best practice like this,./js/main.js
-
Submitting a form reloads the page, so after clicking the submit button the page reloads and returns to its original states; to prevent that use
submit
event-listener
submitBtn.addEventListener("submit", (event) => {
event.preventDefault()
btnClick()
})
event.preventDefault()
will stop the submission process of the form.
- For accessibility issue, wrap your
header
usingmain
tag
I hope this work out. keep coding 👍
Marked as helpful
@Arslanj9
Posted
@deepak-parmar Thank you so much for your valuable feedback.
- Changing
/js/main.js
tojs/main.js
worked. Now javascript is working fine. - Submitting a form isn't reloading my page. I appreciate your feedback since i'm new to javascript and don't know much about Event Listeners, i'll study it to understand it properly because after all its all about learning.
- Oh ok, i was wondering what's that accessibility issue. I used [main] and it fixed it. Thanks again.
Regards