ui.Select.onChange
Registers a callback that's fired when an item is selected.
Returns an ID which can be passed to unlisten() to unregister the callback.
Usage | Returns |
---|
Select.onChange(callback) | String |
Argument | Type | Details |
---|
this: ui.select | ui.Select | The ui.Select instance. |
callback | Function | The callback to fire when an item is selected. The callback is passed the currently selected value and the select widget. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["Registers a callback function that is triggered when a user selects an item in the ui.Select component."],["`onChange()` returns a unique ID that can be used to unregister the callback function using `unlisten()`."],["The callback function receives the currently selected value and the ui.Select widget as arguments."]]],["`onChange` registers a callback function that triggers upon item selection. This function receives the selected value and the `ui.Select` instance as arguments. The method returns a unique string ID. This ID is crucial for later removing the callback using the `unlisten()` function. The `ui.Select` instance is accessible within the callback through the 'this' keyword.\n"]]