Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ui.Slider.onChange
Stay organized with collections
Save and categorize content based on your preferences.
Registers a callback that's fired when the slider's state changes. If the change is due to the user dragging the slider, the event will not fire until the drag completes.
Returns an ID which can be passed to unlisten() to unregister the callback.
Usage | Returns | Slider.onChange(callback) | String |
Argument | Type | Details | this: ui.slider | ui.Slider | The ui.Slider instance. |
callback | Function | The callback to fire when the slider's state changes. The callback is passed the slider's current value and the slider 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."],[[["\u003cp\u003eThe \u003ccode\u003eonChange\u003c/code\u003e method registers a callback function that is triggered when the slider's value changes, but only after a user completes dragging the slider.\u003c/p\u003e\n"],["\u003cp\u003eIt returns a unique ID that can be used with the \u003ccode\u003eunlisten()\u003c/code\u003e method to remove the registered callback.\u003c/p\u003e\n"],["\u003cp\u003eThe callback function receives the slider's current value and the slider widget itself as arguments when invoked.\u003c/p\u003e\n"]]],["The `Slider.onChange` method registers a callback function to be executed when a slider's state changes. This callback is triggered after a user completes dragging the slider, not during the drag. The method accepts a callback function as an argument, which receives the slider's current value and the slider widget itself. It returns a unique ID (string) that can be used to unregister the callback later using `unlisten()`.\n"],null,["# ui.Slider.onChange\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when the slider's state changes. If the change is due to the user dragging the slider, the event will not fire until the drag completes.\n\n\u003cbr /\u003e\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|-----------------------------|---------|\n| Slider.onChange`(callback)` | String |\n\n| Argument | Type | Details |\n|-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.slider` | ui.Slider | The ui.Slider instance. |\n| `callback` | Function | The callback to fire when the slider's state changes. The callback is passed the slider's current value and the slider widget. |"]]