# Change error messages using JS

**URL:** <https://community.hubspot.com/t/change-error-messages-using-js/14826>\
**Category:** Lead Capture Tools\
**Tags:** javascript, forms\
**Created:** [June 18, 2019, 9:20am UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826 "2019-06-18T09:20:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekt](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ekt/32/102945_2.png) [@ekt](https://community.hubspot.com/u/ekt)\
**Post date:** [June 18, 2019, 9:20am UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/1 "2019-06-18T09:20:40Z")

</div>

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');});`

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [June 18, 2019, 12:19pm UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/2 "2019-06-18T12:19:21Z")

</div>

Hey @ekt

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:

 ![Forms _ HubSpot - Google Chrome 2019-06-18 08.18.27.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/6/96eaeb6d1a1931e2e3d646b915f774987e4781cc.png)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![ekt](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ekt/32/102945_2.png) [@ekt](https://community.hubspot.com/u/ekt)\
**Post date:** [June 19, 2019, 7:37am UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/3 "2019-06-19T07:37:18Z")

</div>

Thanks, but still it’s not working

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [June 19, 2019, 2:32pm UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/4 "2019-06-19T14:32:13Z")

</div>

Hey @ekt

Have you checked out how to customize the form embed code? You might find your answer [here](https://developers.hubspot.com/docs/methods/forms/advanced_form_options).

---

<div class="post-metadata">

**Author:** ![ekt](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ekt/32/102945_2.png) [@ekt](https://community.hubspot.com/u/ekt)\
**Post date:** [June 20, 2019, 12:59pm UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/5 "2019-06-20T12:59:17Z")

</div>

Thanks)  
I’ve found another solution - to use setInterval. It’s not a perfect approach so with a client we’ve decided to leave messages as they are.

But now I need to style these messages - is it possible using only css? (the form is in an iframe)

---

<div class="post-metadata">

**Author:** ![Bryantworks](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bryantworks/32/94963_2.png) [@Bryantworks](https://community.hubspot.com/u/Bryantworks)\
**Post date:** [June 20, 2019, 3:38pm UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/6 "2019-06-20T15:38:08Z")

</div>

Yes, that is possible via CSS, you can read more about it here: [https://knowledge.hubspot.com/articles/kcs\_article/forms/how-do-i-style-my-embedded-form](https://knowledge.hubspot.com/articles/kcs_article/forms/how-do-i-style-my-embedded-form)

---

<div class="post-metadata">

**Author:** ![ekt](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ekt/32/102945_2.png) [@ekt](https://community.hubspot.com/u/ekt)\
**Post date:** [June 21, 2019, 8:12am UTC](https://community.hubspot.com/t/change-error-messages-using-js/14826/7 "2019-06-21T08:12:50Z")

</div>

thanks for help!
