reading the value of an input without reloading the cell


I’d like to read the value of an input from a cell without reloading it.

Here an example of my need:

In this sketch, the author created a simple background form and then reads the value in the other cell in this way:

sketch.background(viewof background.valueAsNumber);

this is great because it allows the cell to read the updated value without restarting.

However, if I use observable inputs I cannot use the same strategy.

The only solution I found is to look at the structure of the input and then write something like:

sketch.background(viewof height.getElementsByTagName('input')[0].valueAsNumber);

Is there a more convenient way (and reusable across different type of inputs) to achieve the same result?


It should be viewof height.value

thank you Fil!! Works perfectly