I’d like to use a viewof and a < button > to make interacting with some other cells more convenient. E.g. i might want to tap the button and run “someCell”, or call a function i’ve defined as a cell. But when I reference another cell in the button’s onclick nothing happens. Looking in the dev tools console and I see a “…is not defined” error.
How can I fix this? Or is there a simpler more idiomatic way of doing this?
I assume you have a “code cell” and a “button cell” named button and you want the code cell to run or re-run after clicking the button in the button cell. The button cell should contain some HTML input element, wrapped in viewof. The code cell should refer to the button cell with a button; statement (this does nothing but is important as it tells the Observable runtime that the code cell depends on button):