Although you can attach an onclick event to any type of element, for accessibility, consider only applying this event to elements that are actionable in HTML by default, such as <a>, <button>, or <input> tags in component markup. You can use an onclick event on a <div> tag to prevent event bubbling of a click.