CMS Development

cdesilva
Member

Target specific elements in react-hubspot-form

I've got a Gatsby/React site with react-hubspot-form. That library renders a Hubspot form which I'm able to customize with CSS. I need to target specific elements with JavaScript and cannot figure out how to do so.

 

First, I'd like to be able to target the submit button to add Google Analytics. I've got the form wrapped in a div with GA added, but that unfortunately tracks any click within the form, not just the submit button.

 

Secondly, I'd like to update state when a user clicks a radio button. The different radio buttons will correspond to different URLs and I'm trying to dynamically update those links.

1 Reply 1
lscanlan
HubSpot Alumni
HubSpot Alumni

Target specific elements in react-hubspot-form

Hi @cdesilva,

 

I'm not familiar with react-hubspot-form, but I've moved your post over to our CMS Development forum, since I think you'll have better luck over here. I did find the GitHub repository for that project, which is here: https://github.com/escaladesports/react-hubspot-form. You could try reaching out to the creators there to see if they have any ideas. Otherwise maybe someone else here has used it and they can offer some advice.

 

Leland Scanlan

HubSpot Developer Support