Which HTML tags can be used with onClick?

dom-events, html, javascript, jquery, onclick

Solution

All HTML elements can have an `onclick` attribute.

See the HTML 5 specification for confirmation.

(Of course, some elements are not rendered by default so you would have to alter their `display` properties with CSS before they can be clicked on to trigger the event handler).

Problem

Which HTML tags can have an `onclick` event and which cannot? If there are tags where I cannot include an `onclick` event I want to know why not? ``` onclick="func()" ``` Are there any rules that you should adhere to?

Original source

Related problems