bitty installation snippets examples documentation q&a

snippets

update the content of an element

waiting...
  • The most basic content update is done by sending a signal from one element with a data-s attribute to another element with a data-r attribute.

html

<div data-r="exampleSignal">waiting...</div>
<button data-s="exampleSignal">send signal</button>

javascript

export const b = {};

export function exampleSignal(_, __, el) {
  el.innerHTML = b.time();
}