I would like to integrate hubspot forms within my wordpress site, it all works fine I can submit the form and see the data from hubspot but there is only one problem with the callback function onFormReady() is not being executed due the jQuery is not present.
The error is: The onFormReady function in hbspt.forms.create requires jQuery. It was not run.
Eventhout I have enqued jquery from function.php and I can actually use jQuery for example withi the head script section works.
This is the hubspot code:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/shell.js"></script>
<script>
hbspt.forms.create({
portalId: "x",
formId: "xxxx",
onFormReady: function() {
alert("hello");
}
});
</script>
Any idea how would I be able to execute some code within onFormReady()?
Also if this is not possible, can we somehow catch any submission that happening on the site using jQuery? I tried few ways I was not able to catch the form submission using jQuery!