troubleshooting Question

Execute jQuery after Function

Avatar of Elizabeth Shaules
Elizabeth Shaules asked on
* hubspotCSSjQuery
4 Comments1 Solution333 ViewsLast Modified:

I am embedding a form from HubSpot with this code:
    css: '',
    portalId: 'XXXXXXX',

On page load, this injects a DIV with a form in it.  This DIV has an identifying class "hbspt-form" (which I cannot control the name of, or adding ID's, etc.)    To style it, I am trying to execute this line of code after the above code:
jQuery('[name="firstname"]').addClass( "wpcf7-form-control wpcf7-text" );

Which doesn't work because its executing BEFORE the hbspt.forms.create function (as far as I can tell.)  If I run the jQuery line in the console, after all has loaded, the line works perfectly.  Can you help me create the code necessary to append those two classes at the correct time?

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros