英文:
Problem with my click element in Javascript
问题
I can't make an alert in JS when clicking on the "Submit" button. It's html loaded remotely by a script and the JS can't recognize it.
Here is a reconstruction, anyone have an idea please? Link to the example
<script charset="utf-8" type="text/javascript" src="//js-eu1.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "eu1",
portalId: "26927362",
formId: "46123717-093e-4314-9afb-d71fc6e2e40f"
});
</script>
英文:
I can't make an alert in JS when clicking on the "Submit" button. It's html loaded remotely by a script and the JS can't recognize it.
Here is a reconstruction, anyone have an idea please? http://jsfiddle.net/sdrvqjxn/1/
<script charset="utf-8" type="text/javascript" src="//js-eu1.hsforms.net/forms/embed/v2.js"></script>
<script>
hbspt.forms.create({
region: "eu1",
portalId: "26927362",
formId: "46123717-093e-4314-9afb-d71fc6e2e40f"
});
</script>
答案1
得分: 1
设置onFormSubmit
选项:
hbspt.forms.create({
region: "eu1",
portalId: "26927362",
formId: "46123717-093e-4314-9afb-d71fc6e2e40f",
onFormSubmit() {
alert('submit');
}
});
英文:
Set the onFormSubmit
option:
hbspt.forms.create({
region: "eu1",
portalId: "26927362",
formId: "46123717-093e-4314-9afb-d71fc6e2e40f",
onFormSubmit() {
alert('submit');
}
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论