Running Javascript to Click a button

Hello Bubble World!

I’ve got a button inside a nested repeating group

RG1
RG2
Button

I need to be able to programmatically “click” this button on page load, using javascript.

I’m using toolbox, but it’s not working at this level (inside two RGs). (The button needs to be in the RG to kick off a backend work flow). A javascript test works fine at the page level. Just not inside the RGs.

Do I need to specify that the button is nested w javascript? I’d think that the javascript could just call the getElementById to get the button. Here’s what I’m currently doing.

const button = document.getElementById('test');
button.click();

Thoughts? Much thanks.

Hey @mfsmillie :wave:

Do you know that, if your button is inside a RG, in the end, when your RG is loaded, you will have as many buttons as rows, don’t you? So if your RG have 15 rows, you will have 15 buttons.

Why would you want to click 15 buttons at the same time? If you give us more detais about what you are trying to do, maybe someone will come with a better solution…

1 Like

Yeah, good point. I’m going to try a different approach. much thanks.

1 Like