onClick
OnClick refers to a handler invoked when a user activates an element with a pointing device or keyboard. It is used in HTML, JavaScript, and UI frameworks to run code in response to a click. In markup it appears as onclick, in the DOM as a property named onclick, and in event-driven code via addEventListener('click', …). Frameworks commonly expose onClick as a camelCase prop.
HTML usage: <button onclick="doSomething()">Click me</button> shows an inline handler that executes in the global scope. Inline
JavaScript handling: element.addEventListener('click', handler) registers a listener without replacing others, and supports removal with removeEventListener. The
Accessibility: Use native button, input, or anchor elements for clickable controls. If non-semantic elements are used,
Best practices: prefer addEventListener over inline handlers, detach listeners when no longer needed, and test across