### Bug description

This one has me scratching my head! I have an [example notebook on Observable](https://observablehq.com/d/4edbbf49c9c105af) based on the [Synchronised Inputs](https://observablehq.com/@observablehq/synchronized-inputs?collection=@observablehq/inputs) notebook. In my example, each of three buttons sets three sliders to preset values.

This example works great in  the Observable notebook, but when I try it in Quarto, the buttons won't render unless I disable all of the calls to my `setControls` function but one. The sliders and other element do render, and if I comment out all of the `setControls` calls after the first, all three buttons render too (although of course, only slider is moved by one button).

Here's the code as a QMD:

````
---
title: Test
---

```{ojs}
// use this to update the other controls when we choose a preset
function setControl(input, value) {
  input.value = value;
  input.dispatchEvent(new Event("input", {bubbles: true}));
  return;
}
```

```{ojs}

viewof presetButtons = Inputs.button([
  [  
    "Preset A",
    () => {
      setControl(viewof sliderRed, 30);
      setControl(viewof sliderBlue, 50000);
      setControl(viewof sliderGreen, 1000);
    }
  ],
  [  
    "Preset B",
    () => {
      setControl(viewof sliderRed, 30);
      setControl(viewof sliderBlue, 16000);
      setControl(viewof sliderGreen, 2500);
    }
  ],
  [  
    "Preset C",
    () => {
      setControl(viewof sliderRed, 30);
      setControl(viewof sliderBlue, 16000);
      setControl(viewof sliderGreen, 8000);
    }
  ]
]);
```

#### CONTROLS 

```{ojs}
viewof sliderGreen = Inputs.range([1000, 10000], { label: html`Green` });
```

```{ojs}
viewof sliderBlue = Inputs.range([15000, 70000], { label: html`Blue` });
```

```{ojs}
viewof sliderRed = Inputs.range([0.1, 90], { label: "Red" });
```
````

In Quarto, I also get in the Developer Tools console:

> Uncaught (in promise) TypeError: Cannot read properties of null (reading 'querySelectorAll')
    at quarto-ojs-runtime.js:18729:34
>  (anonymous)   @   quarto-ojs-runtime.js:18729
> Promise.catch (async)
> interpret	@	quarto-ojs-runtime.js:18714
> interpretFromScriptTags	@	quarto-ojs-runtime.js:18759
> (anonymous)	@	(index):207

I'm using Quarto `c976d176a` and R 4.1.2 on MacOS 12.3.1.

### Checklist

- [X] [formatted your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read?
- [X] included a minimal, self-contained, and reproducible example?
- [X] documented the quarto version you're running, by providing the output produced by `quarto check` in a terminal in your issue?
- [X] documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] documented which operating system you're running? If on Linux, please provide the specific distribution as well.
- [X] upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?
cscheid
2022-06-17T06:19:51Z
jimjam-slam
bug
1.0
closed
Buttons that alter several other inputs not rendering
https://github.com/quarto-dev/quarto-cli/issues/1164