blockly > ToolboxItem > getClickTarget
Gets the HTML element that is clickable. The parent toolbox element receives clicks. The parent toolbox will add an ID to this element so it can pass the onClick event to the correct toolboxItem.
Signature:
getClickTarget(): Element | null;
Returns:
Element | null
The HTML element that receives clicks, or null if this item should not receive clicks.
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 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `getClickTarget()` method identifies the HTML element within a ToolboxItem that is designed to receive user clicks, typically the parent toolbox element for event handling."],["This method returns the clickable HTML element or null if the ToolboxItem is not intended to be interactive."],["The parent toolbox uses the ID assigned to the clickable element by this method to correctly route click events to the appropriate ToolboxItem."]]],["The `getClickTarget()` method, part of the `ToolboxItem` class, retrieves the clickable HTML element. This element, identified by the parent toolbox with a unique ID, is the receiver of click events. The method returns this clickable `Element` or `null` if the item shouldn't receive clicks. The parent toolbox element is the one that actually receives the clicks.\n"]]