Events Reference

When users visit your website, they do things like click various links, bring mouse over text and images etc. These are examples of what we call events in JavaScript and VBScript terminologies.

We can write our event handlers using JavaScript or VBScript and can specify some actions to be taken against these events. Though these are the events but they will be specified as attributes for the HTML tags.

The HTML 4.01 specification had defined 19 events but later HTML-5 has added many other events which we have listed down here −

Window Events Attributes

Following are the window events attributes that are listed below −

Sr.NoEvents & Description
1onafterprintTriggers after a document is printed
2onbeforeprintTriggers before a document is printed
3onbeforeunloadTriggers before a document loads
4onerrorTriggers when an error occurs
5onhashchangeTriggers when a document has changed
6onloadTriggers when a document loads
7onofflineTriggers when a document goes offline
8ononlineTriggers when a document comes online
9onpagehideTriggers when a window is hidden
10onpageshowTriggers when a window becomes visible
11onresizeTriggers when a window is resized
12onunloadTriggers when a user leaves the document

Form Events

Following are the Form events attributes that are listed below −

Sr.NoEvents & Description
1onblurTriggers when a window loses focus
2onchangeTriggers when an element changes
3oncontextmenuTriggers when a context menu is triggered
4onfocusTriggers when a window gets focus
5oninputTriggers when an element gets user input
6oninvalidTriggers when an element is invalid
7onresetTriggers when a form is reset
8onsearchThe HTML onsearch event allows to run specific JavaScript code when a user conducts a search action within a searchable input field.
9onselectTriggers when an element is selected
10onsubmitTriggers when a form is submitted

Keyboard Events

Following are the HTML Keyboard Events that are listed below −

Sr.NoEvents & Description
1onkeydownTriggers when a key is pressed
2onkeyupTriggers when a key is released

Mouse Events

Following are the Mouse events attributes that are listed below −

Sr.NoEvents & Description
1onclickTriggers on a mouse click
2ondblclickTriggers on a mouse double-click
3onmousedownTriggers when a mouse button is pressed
4onmousemoveTriggers when the mouse pointer moves
5onmouseoutTriggers when the mouse pointer moves out of an element
6onmouseoverTriggers when the mouse pointer moves over an element
7onmouseupTriggers when a mouse button is released
8onwheelWhen the mouse wheel is over an element, the HTML onwheel event takes place.

Drag Events

Following are the HTML drag events that are listed below −

Sr.NoEvents & Description
1ondragTriggers when an element is dragged
2ondragendTriggers at the end of a drag operation
3ondragenterTriggers when an element has been dragged to a valid drop target
4ondragleaveTriggers when an element leaves a valid drop target
5ondragoverTriggers when an element is being dragged over a valid drop target
6ondragstartTriggers at the start of a drag operation
7ondropTriggers when a dragged element is being dropped
8onscrollTriggers when an element’s scrollbar is being scrolled

Clipboard Events

Let’s look into the following clipboard events that are listed below −

Sr.NoEvents & Description
1oncopyTriggers when an element is copied by the user
2oncutTriggers when an element is removed (cut) by the user
3onpasteTriggers when an element is being pasted into an input field.

Media Events

Following are the Media events attributes that are listed below −

Sr.NoEvents & Description
1ondurationchangeTriggers when the length of a media is changed
2onendedTriggers when a media has reached the end
3onerrorTriggers when an error occurs
4onloadeddataTriggers when media data is loaded
5onloadedmetadataTriggers when the duration and other media data of a media element is loaded
6onloadstartTriggers when the browser starts loading the media data
7onpauseTriggers when media data is paused
8onplayTriggers when media data is going to start playing
9onplayingTriggers when media data has started playing
10onprogressTriggers when the browser is fetching the media data
11onratechangeTriggers when the playing rate of media data has changed
12onseekedTriggers when the seeking attribute of a media element is no longer true, and the seeking has ended
13onseekingTriggers when the seeking attribute of a media element is true, and the seeking has begun
14onstalledTriggers when there is an error in fetching media data
15onsuspendTriggers when the browser has been fetching media data, but stopped before the entire media file was fetched
16ontimeupdateTriggers when media changes its playing position
17onvolumechangeTriggers when a media changes the volume, also when volume is set to “mute”
18onwaitingTriggers when media has stopped playing, but is expected to resume

Misc Events

Following the misc event listed below −

Sr.NoEvent & Description
1ontoggleIn general, the toggle means it toggles between hide() and show() for the selected element.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *