We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jul 5, 2018 9:24 AM
Hello Community!
I'm trying to add a jQuery to the header of my page, but for reason is not running. Also i tried putting the code in the console and it runs properly.
I just want to remove the second error message appearing in Subscription module in Hubspot using jQuery.
Anyone knows the reason why it has this behavior?
Solved! Go to Solution.
Jul 5, 2018 9:28 AM - edited Jul 5, 2018 9:30 AM
@karensantana - I'm willing to bet that, since forms are loaded dynamically with JS, your script is triggering way too early, before the form elements have rendered. That's why you can run the script in console and it works. Most likely you are running the script when you can visibly see the form or the elements of the form you are trying to remove. Try putting your script in an interval just to test if it gets executed after a few seconds
setInterval(function(){ // run your code here }, 1000);
If this answer helped, please, mark as solved 😄
tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.
Jul 5, 2018 9:28 AM - edited Jul 5, 2018 9:30 AM
@karensantana - I'm willing to bet that, since forms are loaded dynamically with JS, your script is triggering way too early, before the form elements have rendered. That's why you can run the script in console and it works. Most likely you are running the script when you can visibly see the form or the elements of the form you are trying to remove. Try putting your script in an interval just to test if it gets executed after a few seconds
setInterval(function(){ // run your code here }, 1000);
If this answer helped, please, mark as solved 😄
tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.
Jul 5, 2018 9:39 AM
Thank you so much for your quick response!
I thought that with $(document).ready was enough, it worked like a charm.
Thanks again!