0

Why does the submit input clear my screen?

I'm making a form, but I don't want it to disappear after I hit submit. How do I fix this?

2nd Apr 2023, 8:46 PM
Steel
Steel - avatar
4 Respostas
+ 6
When we place a <button> in a <form>, it is recommended to explicitly specify the 'type' attribute for the <button> https://html.com/attributes/button-type/ One of the reason was to prevent the <button> to be mistakenly understood as the button for submitting the <form>, while it may not be the actual intention. In case of 'submit' event interception, best answer in below stackoverflow page provides a decent example IMO https://stackoverflow.com/questions/3350247/how-to-prevent-form-from-being-submitted
2nd Apr 2023, 10:55 PM
Ipang
+ 4
Do you have a link to the codebit where this is happening?
2nd Apr 2023, 9:52 PM
Justice
Justice - avatar
2nd Apr 2023, 10:00 PM
Steel
Steel - avatar
+ 1
they does not disappear..the submit button basically tries to perform the action of form submission theirby refreshing the link
4th Apr 2023, 7:27 PM
Vinome
Vinome - avatar