CMS Development

Neenu
Member

Not able to add event to dependent fields in hubspot form

I have a Hubspot form added on a HubSpot page. I need to change the CSS styling of radio buttons on clicking the button. I am not able to achieve the same on the dependent field of a Hubspot form, but it works fine in normal fields on the form.

 

Below is the code that works on all except dependent fields.

if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
$('.hs-form-radio-display').click(function(){
$(".hs-form-radio-display").css('background-color', 'white');
$("input[type='radio']:checked").parent().css('background-color', 'blue');
});
}

 

How can I achieve this on dependent fields?

 

Thanks,

Neenu

0 Upvotes
3 Replies 3
jennysowyrda
Community Manager
Community Manager

Not able to add event to dependent fields in hubspot form

Hi @Neenu,

 

Do you have a link to the page you are working on? The more information, screenshots and links you can provide, the better the Community can assist!

 

Thank you,

Jenny

0 Upvotes
Neenu
Member

Not able to add event to dependent fields in hubspot form

Found a workaround. Thanks for the help 

0 Upvotes
jennysowyrda
Community Manager
Community Manager

Not able to add event to dependent fields in hubspot form

Hi @Neenu,

 

Glad you were able to resolve the issue! Would you be willing to share your workaround with the Community to assist future users experiencing this issue?

 

Thanks,
Jenny