JavaScript to Bubble Uncaught Reference Error

Hi Everyone,

I am having trouble passing data from some custom JavaScript in an HTML element to the JavaScripttoBubble element on my page. I am not sure what is wrong in the setup since I am using the same method that I have used in the past to do this and it has worked. However, when doing it in my new app. I keep getting an Uncaught Reference Error saying that the bubble_fn_ function is undefined. This suggests that the JavaScript to Bubble element is not initializing the function for some reason.

And this is the error message I get in the console in response:

I was wondering if anyone has come across this problem before and knows what could be causing it. I wasn’t sure if there is possibly something in the settings that is preventing the JS to Bubble element from initializing the function because I think my setup here looks correct and it is the same as in another app I have where it is working.

Thanks for the help!

Adding @mishav - thank you for the great plugin and hoping you might have some insight here!

I think what may be happening is your HTML element is being rendered before the JavascriptToBubble element is being rendered.

So the script in the HTML element is being ran before the JavascriptToBubble element is visible on the page.

Try setting the HTML element to not visible on page load, and set a conditional to show the HTML element after page loaded (entire)

Thanks @tim12333, that was something I hadn’t considered but makes perfect sense. I actually ended up achieving what I wanted to without having to run any custom javascript but I will definitely keep your advice in mind for the future.

1 Like