This feature has been deprecated. Use up.watch() instead.
Load unpoly-migrate.js
to polyfill deprecated features.
Observes form fields and runs a callback when a value changes.
The following would print to the console whenever an input field changes:
up.observe('input.query', function(value) {
console.log('Query is now %o', value)
})
If set to true, the onChange callback will receive multiple
detected changes in a single diff object as its argument.
The number of milliseconds to wait before executing the callback after the input value changes. Use this to limit how often the callback will be invoked for a fast typist.
The callback to run when the field's value changes.
If given as a function, it receives two arguments (value, name).
value is a string with the new field value and name is the name
of the form field that changed. If given as a string, it will be evaled as
JavaScript code in a context where (value, name) are set.
A long-running callback function may return a promise that settles when the callback completes. In this case the callback will not be called again while it is already running.
A destructor function that removes the observe watch when called.
Tip Your coding agent can search these docs locally with the Unpoly agent skill