LZ.setValueFromElement()

The LZ.setValueFromElement() function sets (or updates) the value of the specified bucket to the specified element's value.
The function has the following signature:

setValueFromElement(bucketName, elementSelector, mode = "text", forceChange = false)

Where:

If the element with the specified selector does not exist, the action is aborted.

A simple example:

<p lz-reactive lz-bucket="myBucket"></p>
<p id="content-paragraph">This is my content.</p>
<script>
    LZ.setValueFromElement("myBucket", "#content-paragraph");
</script>

If we specified "content" as the mode, content-paragraph could have had other HTML elements inside.

All the standard behaviour of LZ.setValue() applies to LZ.setValueFromElement() too.

This is a slower version of LZ.setValueFromElementId(). Prefer that whenever possible.