簡體   English   中英

Hubspot:HTML元素的自定義屬性

[英]Hubspot: Custom Attribute to HTML Element

/如果有/將自定義屬性添加到Hubspot中的HTML元素,更具體地說,添加到Hubspot創建的<form>元素中的最佳方法是什么?

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

*編輯:

靜態解決方案會更好,因為它將用於表單分析中。

謝謝!

如果您有權訪問自定義代碼部分,並且假設您擁有jQuery,則可以執行以下操作:

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

而且如果您沒有jQuery:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM