Kevin Aartsen Kevin Aartsen - 1 year ago 58
HTML Question

Jquery showing once after submit

I made this form and added some jquery to it. The jquery part is supposed to make a div show if i click on submit.
It does this but only once the it refreshes the page and the div goes back to hidden. I have everything in the same file the jquery and the php and the html.
How do i make the jquery stay.

<form class ="form" method="post">
<h3>Select your trademark</h3>
<select class="form-control" name="trademark">

<h3>Your company name</h3>
<input class="form-control" type="text" name="companyName" action="">


<button class="form-control" type="submit" name="submit">



Tried prevent default with Jquery it works it doesnt reload but it doesnt post the filled in data from form in my page.

Answer Source

Add onsbumit="return false" to your <form>. By returning false from the onsubmit handler you prevent the form from being submitted (no further requests are sent to the server, and the page is not reloaded).