HTML
CSS
JavaScript
jQuery
PHP
SQL
WordPress
HTML Reference

Quick Reference

This is a quick reference list of HTML events that can be used to trigger JavaScript functions and run them on the page.

Clipboard Events

HTML – oncopy Event

The oncopy event fires when the user copies the contents of an element or an image to their clipboard.

HTML – oncut Event

The oncut event fires when the user cuts the contents of an element or an image to their clipboard.

HTML – onpaste Event

The onpaste event fires when the user pastes content from their clipboard into an HTML element.

Drag Events

HTML – ondrag Event

The ondrag event fires when an element or text selection is being dragged via drag and drop.

HTML – ondragend Event

The ondragend event fires when the user has finished dragging an element or text selection via drag and drop.

HTML – ondragenter Event

The ondragenter event fires when a draggable element or text selection enters a valid target where it can be dropped via drag and drop.

HTML – ondragleave Event

The ondragleave event fires when a draggable element or text selection leaves a valid drop target where it can be dropped via drag and drop.

HTML – ondragover Event

The ondragover event fires when a draggable element or text selection is being dragged over a valid drop target via drag and drop.

HTML – ondrop Event

The ondrop event fires when a draggable element or text selection is dropped on a valid drop target via drag and drop.

Form Events

HTML – onblur Event

The onblur event fires when a form field loses focus, and is often used with form validation. The onblur event is the opposite of the onfocus event.

HTML – onchange Event

The onchange event fires when the value of the element is changed by the user and the element loses focus.

HTML – onfocus Event

The onfocus event fires when a form field gains focus as the user clicks into it. The onfocus event is the opposite of the onblur event.

HTML – onfocusin Event

The onfocusin event fires when a form field is about to gain focus as the user clicks into it. The onfocusin event is the opposite of the onfocusout event.

HTML – onfocusout Event

The onfocusout event fires when a form field is about to lose focus as the user clicks out of it. It’s the opposite of the onfocusin event.

HTML – oninput Event

The oninput event fires when the value of an HTML input or textarea element is first input or is changed.

HTML – oninvalid Event

The oninvalid event fires when an input element is invalid (e.g., if the required attribute is set and the field is empty).

HTML – onsearch Event

The onsearch event fires when a user presses the “enter” key or clicks the “x” button in an input element with type=”search”.

Keyboard Events

HTML – onkeypress Event

The onkeypress event fires when the user presses a key on the keyboard, but is not fired for all keys (e.g. ALT, CTRL, SHIFT, ESC).

Media Events

HTML – onabort Event

The onabort event fires when the loading of an audio/video file is aborted, but not due to error.

HTML – oncanplay Event

The oncanplay event fires when the video has buffered enough for the browser to start playing the specified audio/video.

HTML – oncanplaythrough Event

The oncanplaythrough event fires when the browser estimates it can play through the specified media without having to stop for buffering.

HTML – onemptied Event

The onemptied event fires when the media encounters some fatal error, the file becomes unavailable, or the media playlist is empty.

HTML – onerror Event

The onerror event fires when an error occurs while loading an external file like an img, object, link, or script.

HTML – onloadeddata Event

The onloadeddata event fires when data for the current frame is loaded, but not enough data to play the next frame.

HTML – onplaying Event

The onplaying event fires when the audio/video is playing after having been manually/programmatically paused or had stopped to buffer.

HTML – onratechange Event

The onratechange event fires when the playing speed of the audio/video has changed (to a slow motion or fast forward mode).

HTML – onseeked Event

The onseeked event fires when the user is finished moving or skipping to a new position in the track.

HTML – onvolumechange Event

The onvolumechange event fires each time the volume of the video/audio has been changed by increasing/decreasing it or by muting/unmuting it.

Mouse Events

HTML – onwheel Event

The onwheel event fires when the wheel of a pointing device is rolled up/down over an element, or the user scrolls/zooms on an element with a touchpad.

Touch Events

Window Events

HTML – onbeforeunload Event

The onbeforeunload event fires when the user has made an action to leave the current page. Most browsers provide a default message.

HTML – onerror Event

The onerror event fires when an error occurs while loading an external file like an img, object, link, or script.

HTML – onhashchange Event

The onhashchange event fires when there has been a change to the anchor part of the page’s URL (the anchor begins with the # symbol).

HTML – onload Event

The onload event fires when an element has been loaded, and is often used to run a script once the webpage has completely loaded all content.

HTML – onpagehide Event

The onpagehide event fires when the user is leaving a webpage by clicking a link, refreshing the page, submitting a form, closing the window, etc.

HTML – onunload Event

The onunload event fires when the user navigates away from the page by clicking a link, submitting a form, closing the browser window, etc.

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

HTML
CSS
JavaScript
jQuery
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.