Public
Edited
Jan 16, 2023
Paused
28 stars
Insert cell
Insert cell
Insert cell
myName = "Fabian"
Insert cell
myName
Insert cell
Insert cell
myName2 = htl.html`<input type="text" value="Fabian">`
Insert cell
Insert cell
myName2
Insert cell
Insert cell
myName2.value
Insert cell
Insert cell
Insert cell
viewof myName3 = htl.html`<input type="text" value="Fabian">`
Insert cell
viewof myName3
Insert cell
myName3
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof word_of_the_day = {
// The parent element, on which we'll set the value.
const myView = htl.html`<p>`;
for(const word of ["The", "bird", "is", "the", "word"]) {
const style = 'cursor: pointer; border: 2px solid #50f5; margin: .1em';
const clickableWord = htl.html`<strong style="${style}"> ${word} </strong>`;
myView.appendChild(clickableWord);
clickableWord.onclick = () => {
// Set the new value:
myView.value = word;
// This tells Observable that the value has changed:
myView.dispatchEvent(new Event("input", {bubbles: true}));
};
}
return myView;
}
Insert cell
Insert cell
word_of_the_day
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more