Skip to content
Advertisement

On submit, load a html popup file into a div

I am trying to redirect to a contact form on submit to a HTML file which I have made using.

JavaScript

However, this loads it to a different page and not to the page that I’m already on.

I already have the jQuery to make a popup for the contact form and information page, which is:

JavaScript

On submitting the contact form, I want to load a new file (thanks.html) to replace the popup (contact form) with a thank-you message. Similar to what I’m doing with the jQuery already, but I want it to only implement on submit:

JavaScript

What do I need to do to modify my jQuery so it implements on submit instead of on click?

Advertisement

Answer

Add the submit event to the contact form:

If you use jQuery 1.7+, use on:

JavaScript

If not, use live (or upgrade your jQuery version):

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement