Prevent default event Contact Form 7
-
Hi,
I’m currently trying to generate directions through the Google Maps API v3. I want to combine this with Contact Form 7. When a user submits the form, I want to calculate the directions between point A and point B.
The input field id’s are grabbed through a JS file and hooked to the API. When I press submit, Contact Form 7 generates the failure to send message.
The inside of my form looks like this:
<div id=”calculate-route”>[submit “Send”]</div>This is in the JS file:
$(“#calculate-route”).submit(function(event) {
event.preventDefault();
calculateRoute($(“#from-point”).val(), $(“#to-point”).val());
});Any ideas why event.preventDefault() isn’t working? I enqueued the JS script succesfully in the footer. Using a plain HTML form generates the map and directions properly, I want to use Contact Form 7 so my client/my team can edit elements.
- The topic ‘Prevent default event Contact Form 7’ is closed to new replies.