lz-source
The attribute lz-source
is used to specify the HTML id of the element to use as the source of the value of the reactive element.
<p lz-reactive lz-source="my-input"></p> <input type="text" id="my-input">
In this example, Leeze.js will automatically use the input
element's value to change the paragraph content. It does so by adding an event listener to the oninput
event and removing it if the reactive element gets deleted from the DOM.
By default, Leeze.js will hook up to the oninput
event and will use the value contained in the value
property of the source element.
This is fine for most input
types, but for other types (such as type="checkbox"
) and other tags, you can specify the event and value property using
the lz-source-event and lz-source-value attributes respectively.
You can technically use both lz-bucket
and lz-source
on a reactive element but there is no guarantee that they both will work.