Editor / DOM Helper / watchInput
Function: watchInput()
ts
function watchInput<T>(
selectors,
callback,
opt?): void;Watches for changes on input elements and triggers a callback with the updated values.
- Supports single or multiple selectors.
- Calls the callback every time an input event occurs on the specified elements.
Type Parameters
| Type Parameter | Default type |
|---|---|
|
|
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| A single selector string or an array of selector strings. |
| ( | A function to call with the updated values of the inputs. |
| { | ‐ |
|
| ‐ |
Returns
void
Example
ts
watchInput('$input-id', (values) => console.log(values));
watchInput(['$input-1', '$input-2'], (values) => console.log(values));