🏠 back to Observable

Preventing input viewof refreshing and triggering recalculations except onchange


I’m trying to build an interface with a datalist whereby the value of the interface only updates when the ‘onchange’ event is triggered.

I have it working, in the sense the value of the interfaces contains what I want. But the value of it is refreshed too frequently - on all keyboard events, rather than just onchange - resulting in everything else in my notebooks being recalculated unnecessarily.

See a simple example here:

I’ve been experimenting with e.stopPropagation(), but either this isn’t the correct approach, or I’m not using it right.

How can I stop the value my_val refreshing on every keypress?

Very grateful for any help,


Aha! - this seems to work:

as.oninput = (e) => {e.stopPropagation()   }

Here’s one approach:

1 Like

Thank you!