Forum Academy Marketplace Showcase Pricing Features

Trigger event in html element on change in input form

I have the following script in an HTML Element:

var inp = $(‘input[placeholder=“togglePixel”]’)
inp.val(“hello”);
inp.addEventListener(“onfocus”, myfunc);

function myfunc() {
}

When I load the page, the code up to and including inp.val(“hello”); executes, but the addEventListener stops the code.

Any thoughts on how to fix this?

Thanks in advance!

Your handler function myfunc() isn’t returning a true value, so it prevents other handlers from seeing the onfocus event.

If you want the script to trigger a changed event, to be handled in Bubble’s workflow, add the following:
inp.change();

Good luck : )

This topic was automatically closed after 70 days. New replies are no longer allowed.