How to add a keyup EventListener to a form element
SOLVE
I'm trying to add a keyup event to the Company field on a form. I'm trying to do it via the Additional Code Snippets on the Template, but can't figure it out.
I also tried addEventListener, but it failed. I also tried wrapping my keyup in a setTimeout function to allow the form to be loaded. Nothing seems to work. I'm not sure if this is a timing issue, or something else is going on.
How to add a keyup EventListener to a form element
SOLVE
@tjoyce , I haven't published it - just testing in preview. But I can see with the inspector that the field is "company". It's just the standard HubSpot Company Name property. And I'm still perplexed why I don't get anything in the console for:
Apr 14, 20218:10 AM - edited Apr 14, 20218:12 AM
Recognized Expert | Elite Partner
How to add a keyup EventListener to a form element
SOLVE
can you still link us to the preview of the page? @johnwfoster
Also, don't preview like that... hit the "open in new window" button....
I'm not sure the events will bubble that far out of the iframe to hit your callback code (I have reported inconsistencies with this to HubSpot in the past). Just open in new window to remove the extra iframe from the equation.
How to add a keyup EventListener to a form element
SOLVE
@johnwfoster - If you want to drop a link to the page your form is on, we can double check the correct name of that field and make sure that's working.