Published
Edited
May 16, 2020
Insert cell
Insert cell
function my_interface() {

let as = html`<input list=options>
<datalist id="options">
<option value="One">
<option value="Two">
</datalist>`;

let div = html`<div>${as}`;
div.value = ''
as.onkeydown = (e) => {e.stopPropagation() }
as.onkeyup = (e) => {e.stopPropagation() }

as.onchange = () => {
console.log("onchange fired")
let raw_value = as.children[0].value;
div.value = as.children[0].value;
div.dispatchEvent(new CustomEvent('input'));
};
return div;
}
Insert cell
viewof my_val = my_interface()
Insert cell
my_val
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more