Jun 18, 20195:20 AM - edited Jun 18, 20198:21 AM
Participant
Change error messages using JS
SOLVE
I need to change error messages for my form and I don't have an opportunity to use raw html for form, only iFrame.
When I'm writing js-code for it in the console - everything is working, but when I'm adding js-code to the page (like a separate file or before closing <body> or to the setting of all pages) - it's not working. I can see this code in developer tools, but it works only when I'm copying it to the console.
Is there any chance to fix it?
Here is the code
$( document ).ready(function() { $('.subscribe-form-wrapper .hs-form-iframe').contents().find('.hs-error-msg').css('display', 'none'); $('.subscribe-form-wrapper .hs-form-iframe').contents().find('.hs-error-msgs .hs-main-font-element').text('Please, share your work email with us'); });
Due to the way the forms are rendered, you would have to use the embed code to enable this functionality. This embed function is available on all tiers of HubSpot: