Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003egetClickTarget()\u003c/code\u003e method identifies the HTML element within a ToolboxItem that is designed to receive user clicks, typically the parent toolbox element for event handling.\u003c/p\u003e\n"],["\u003cp\u003eThis method returns the clickable HTML element or null if the ToolboxItem is not intended to be interactive.\u003c/p\u003e\n"],["\u003cp\u003eThe parent toolbox uses the ID assigned to the clickable element by this method to correctly route click events to the appropriate ToolboxItem.\u003c/p\u003e\n"]]],["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"],null,["[blockly](./blockly.md) \\\u003e [ToolboxItem](./blockly.toolboxitem_class.md) \\\u003e [getClickTarget](./blockly.toolboxitem_class.getclicktarget_1_method.md)\n\nToolboxItem.getClickTarget() method\n\nGets 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.\n\n**Signature:** \n\n getClickTarget(): Element | null;\n\n**Returns:**\n\nElement \\| null\n\nThe HTML element that receives clicks, or null if this item should not receive clicks."]]