admin 管理员组文章数量: 1086019
Hi I'm following hubspot's documentation on how to embed a form on an external site
According to documentation, one needs to include the javascript
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms/forms/v2.js"></script>
<script>
and to create the form
<script>
hbspt.forms.create({
portalId: '2089699',
formId: '287337b2-e8a6-4eaa-b293-bbd3d3622d8a'
});
</script>
And that's as far as the documentation goes. I do this and nothing is happening. Seems that at least I would need to tell hubspot where to put the form, right?... very strange.
Can anyone enlighten me on this one? What am I missing?
Hi I'm following hubspot's documentation on how to embed a form on an external site
According to documentation, one needs to include the javascript
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms/forms/v2.js"></script>
<script>
and to create the form
<script>
hbspt.forms.create({
portalId: '2089699',
formId: '287337b2-e8a6-4eaa-b293-bbd3d3622d8a'
});
</script>
And that's as far as the documentation goes. I do this and nothing is happening. Seems that at least I would need to tell hubspot where to put the form, right?... very strange.
Can anyone enlighten me on this one? What am I missing?
Share Improve this question edited Mar 7, 2016 at 2:49 Martin Massera asked Mar 5, 2016 at 4:30 Martin MasseraMartin Massera 1,9121 gold badge25 silver badges51 bronze badges2 Answers
Reset to default 6Ok, answering my own question!
What's needed is the target
option to tell hubspot where to put the form:
<script>
hbspt.forms.create({
portalId: '2089699',
formId: '287337b2-e8a6-4eaa-b293-bbd3d3622d8a',
target: '#my_form',
});
</script>
My solution for the similar task was create hubspot form on DOM ready.
<script>
document.addEventListener("DOMContentLoaded", function() {
hbspt.forms.create({
css: '',
target: '#target',
portalId: 'portal_id',
formId: 'form_id'
});
});
</script>
本文标签: javascripthow to embed a hubspot form in an external siteStack Overflow
版权声明:本文标题:javascript - how to embed a hubspot form in an external site - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744022322a2520023.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论