简体   繁体   中英

Hubspot: Custom Attribute to HTML Element

What could be the best way /if there is any/ to add custom attribute to HTML element in Hubspot, more specifically, to the < form > element created by Hubspot?

<form id="form-id" myAtrribute="myValue"></form>

*Edit:

Static solution would be better, as it is going to be used in form analytics.

Thanks!

If you have access to the custom code section, and assuming you have jQuery, you can simply do:

<script>
   $("#form-id").attr("myAttribute", "myValue");
</script>

And if you do not have jQuery:

<script>
    document.getElementById("form-id").setAttribute("myAttribute", "myValue")
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM