# Assistance Needed for Adding CSS Class to HubSpot Form Button

**URL:** <https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141>\
**Category:** CMS Development\
**Tags:** enterprise\
**Created:** [November 8, 2024, 4:18pm UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141 "2024-11-08T16:18:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cole\_Edwards](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cole_edwards/32/202691_2.png) [@Cole\_Edwards](https://community.hubspot.com/u/Cole_Edwards)\
**Post date:** [November 8, 2024, 4:18pm UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141/1 "2024-11-08T16:18:40Z")

</div>

Hi HubSpot Developer Community,

I’m currently working on integrating HubSpot forms into our WordPress site and need some help with adding a CSS class to the submit button for tracking purposes.

### Here’s what I’m trying to achieve:

I want to add a CSS class (e.g., hs-form-submit) to the submit buttons of our HubSpot forms so that I can track clicks using Google Tag Manager.

### What I Need Help With:

1. **Adding the CSS Class** : Is there a way to add the class to the submit buttons site wide on a WordPress Website?

I appreciate any guidance or examples you can provide. Thank you in advance for your help!

Best,

Cole

---

<div class="post-metadata">

**Author:** ![GiantFocal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/giantfocal/32/41969_2.png) [@GiantFocal](https://community.hubspot.com/u/GiantFocal)\
**Post date:** [November 8, 2024, 4:24pm UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141/2 "2024-11-08T16:24:20Z")

</div>

Hi [@Cole\_Edwards](https://community.hubspot.com/t5/user/viewprofilepage/user-id/763900),

Do you need to track only a specific form’s submit button or ALL submit buttons on the site?

If all submit buttons, you can track the

**.hs\_submit .hs-button**

default classes.

---

<div class="post-metadata">

**Author:** ![Cole\_Edwards](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cole_edwards/32/202691_2.png) [@Cole\_Edwards](https://community.hubspot.com/u/Cole_Edwards)\
**Post date:** [November 8, 2024, 4:33pm UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141/3 "2024-11-08T16:33:18Z")

</div>

Awesome! Yes, we are looking to track all submissions sitewide. So this should work.

The reason we are doing this is to set up enhanced conversions with our Google ads. Is their a default class for the “Email” field we can track as well?

---

<div class="post-metadata">

**Author:** ![albertsg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/albertsg/32/99473_2.png) [@albertsg](https://community.hubspot.com/u/albertsg)\
**Post date:** [November 8, 2024, 4:38pm UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141/4 "2024-11-08T16:38:43Z")

</div>

Hi [@Cole\_Edwards](https://community.hubspot.com/t5/user/viewprofilepage/user-id/763900), I don’t think you can add custom classes to the default buttons that HubSpot adds to the forms.

If you cannot change your tracking strategy/settings to track the classes that the buttons have as default (such as the ones Abraham mentions in his reply), you could try adding your custom classes via Javascript.  
See this as reference: [Element: classList property - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList) (to be exact, you might want to use the [.add()](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add) method).

---

<div class="post-metadata">

**Author:** ![Cole\_Edwards](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cole_edwards/32/202691_2.png) [@Cole\_Edwards](https://community.hubspot.com/u/Cole_Edwards)\
**Post date:** [November 8, 2024, 5:09pm UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141/5 "2024-11-08T17:09:35Z")

</div>

Got it! Is their a default class for the “Email” field we can track as well?

---

<div class="post-metadata">

**Author:** ![melindagreen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/melindagreen/32/73804_2.png) [@melindagreen](https://community.hubspot.com/u/melindagreen)\
**Post date:** [November 11, 2024, 1:01am UTC](https://community.hubspot.com/t/assistance-needed-for-adding-css-class-to-hubspot-form-button/120141/6 "2024-11-11T01:01:27Z")

</div>

[@Cole\_Edwards](https://community.hubspot.com/t5/user/viewprofilepage/user-id/763900) for the email field, there’s no class to directly access it but try

.hs-email .input input

(note that it’s class, class, tag name)
