×

HTML Event Attributes

HTML Event Attributes

If a browser responds to the user behavior, an event is called. For example, if we click on the submit button, a box of details will appear on the screen.

There are lots of event attributes in HTML5 and programming languages, such as JavaScript.

The following is a table of event attributes allowing us to execute several events using those attributes.

Windows Event Attributes

For the window object, Windows events are linked. It can only added with < body > tag.

AttributeDescription
On-after-printAfter the document has been written, the script has executed.
On-before-printThe script has executed before imprinting a document.
On-before-unloadBefore uploading a document, she executed the script.
On-errorThe script was executed when an error occurred.
On-hash-changeWhen the anchor part in the webpage URL is changed, the script is executed.
On-massageThe script was executed when a message occurs.
On-offlineWhen the network connection is broken, the script was executed, and the browser started working offline.
On-onlineThis script was executed when the browser began operating online.
On-loadThe script was executed when the webpage is fully loaded.
On-page-hideWhen the current web page is hidden, the script is executed. It appears as if the user had moved away from the current web page.
On-page-showExecuted the script when focused primarily on the current website.
On-resizeThe script is executed when the window is resized.
On-pop-stateThe script is executed when the active history of the window is changed.
On-unloadWhen the current webpage is removed, execute the file, or the window is closed.
On-storageThe script was executed when web storage is modified.

Form Event Attributes

Form event occurs when some activities are carried out by the user within the program, such as sending the request, selecting the input field, etc.

Events of form can be used for any element, but these are primarily used for aspects of HTML form.

The following is a list of all attributes for Form Events:

AttributeDescription
OnblurThe script was executed when the form item loses focus.
OnfocusIt triggers an event when it focuses on an element.
OninputThe script is executed when the user enters the element input.
OnchangeWhen the element value is changed, the script is executed.
OnresetTriggers the event when the values for the form element are reset by the user.
On-invalidThe script was executed when the element does not fulfill its predefined constraints.
On-selectTriggers an event when any text has been selected by the user.
On-searchTriggers an event when input is received from a search field.
OnsubmitTriggers the event when a form has been submitted.

Keyboard Event Attributes

The event on the keyboard is when the user communicates with the keyboard. The Keyboard Events list below.

AttributeDescription
OnkeydownTriggers the event by pressing a key downwards on the keyboard.
OnkeypressTrigger the event by pressing the key that displays a particular character.
OnkeyupIf the user releases the currently pressed key, trigger the event.

Mouse Event Attributes

AttributeDescription
OnmousedownActivate the event when the item clicks on the mouse button.
OnmousemoveCause an event when the item is moving over the mouse pointer.
OnclickTrigger the event by clicking the mouse on the item.
On-db-clickTrigger the event when the element is double-clicked on the mouse.
OnmouseoverTrigger the event by moving the mouse on to the feature.
OnmouseoutTrigger the event by moving the mouse outside of the feature.
OnmouseupTrigger event by mouse button release.
On-wheelTrigger the event if the mouse wheel rolls, up or down, over the object.
OnmousewheelIt's deprecated. Using the onwheel attribute.

Clipboard Event Attributes

AttributeDescription
On-copyTrigger an activity when the user copies the contents into the machine clipboard.
OncutTrigger an event when the element's contents are cut into the clipboard and copied.
OnpasteTrigger the event by pasting any content into an item.

Media Event Attribute

AttributeDescription
OnabortWhen media replay is aborted, this script was executed.
OncanplayThe script was executed when a media file is ready to play.
OncanplaythroughThe script was executed when the media file is ready to play without stopping or buffering.
OndurationchangeExecute a script when the duration of the media file is changed.
OncuechangeThe text cue of the < track > element script is changed.
OnemptiedExecute a script if a media error occurs, and the file becomes unavailable.
OnendedThe script was executed when its endpoint occurs in the media file.
OnerrorThe script was executed when an error occurred while the media data was being fetched.
OnloadeddataThe script was executed while loading media data.
OnloadedmetadataThe script is executed when the media file metadata is loaded.
OnloadstartThe script was executed when loading of media file starts.
OnpauseWhen the media playback is stopped, the script is executed.
OnplayWhen after being paused, the media file is ready to play, the script is executed.
OnplayingWhen a media file is started running, the script was executed.
OnprogressThe script was executed when the user is in the process of obtaining the media info.
OnratechangeWhen the playback speed was changed, the script executed.
OnseekedWhen the search for operation is over, the script is cleared, and the feature is searched.
OnseekingWhen the search operation is active, the script executed, and the search attribute set to true.
OnstalledThe script was run when the browser suddenly stopped fetching data media.
On-suspandIf fetching media data is intentionally stopped, the script is executed.
OntimeupdateWhen the playback position is changed, the script executed as though a user fasts the track forward.
OnvolumechangeThe script is executed when the volume of media is changed (muted or unmuted).
OnwaitingIf playback is paused to wait for more data to be loaded, the script executed.

Related Topics

HTML Basic Tags

Heading Tags: This tag represents the document header. It is said to be a good practice if every document starts with Heading. Heading tags ranges from H1 to H6 i.e....

3 minutes read.

CSS Clearfix

CSS Clearfix: A clearfix (or clear float) in CSS is for a component to clear or fix the child component, so we don’t need to insert additional markup. The clear...

4 minutes read.

HTML &lt;blink> Tag

In HTML, the blink tag is used to create the text which flashes. The blink tag is an inline element in HTML. It is observed that the blink tag used...

2 minutes read.

HTML SVG

HTML SVG: SVG stands for Scalable Vector Graphics which defines the graphics for the web. It is a language for describing 2-D graphics in XML. Each drawn shape in SVG is...

1 minute read.

How to insert spaces/tabs in text using HTML/CSS

What is HTML? HTML or HyperText Markup Language is used to design web pages. It was released in 1993. The file extension name for HTML file is “.html”. An HTML file...

4 minutes read.

HTML Paragraphs

In html, there are some elements which starts with new line and one of them is paragraph. Which is said to be a block of text. In html <p> tag...

4 minutes read.

How to append HTML code to a div using JavaScript?

In HTML, we have a div tag which is used to create a box where we can put a lot of other tags. So it works like a container. So,...

4 minutes read.

HTML Hide Element

The HTML hide element is used to hide the element. We place the hidden attribute inside those elements which we want to hide. The hidden attribute is a Boolean attribute. The...

3 minutes read.

HTML Attributes

HTML Attributes provide the additional information about HTML elements. Attributes are always specified in the start tag. Attributes usually comes in pairs. lang Attribute This attribute helps in declaring the language...

2 minutes read.

HTML Lists

HTML List HTML lists are used to specify data sets. All lists can include one or more elements from the list. HTML lists are available in three different types: Ordered List or...

4 minutes read.

How to change text color in HTML

Changing the text colour of a web page is essential because it enhances readability. There are several ways to change the colour of the text in HTML, which are as follows: Text...

7 minutes read.

Html &lt;center> Tag

The term HTML refers to Hyper Text Markup Language. The most widely used markup language for making web pages is HTML. A structure of web page is described in HTML....

3 minutes read.

HTML Form Input Types

HTML Form Input Types An important element of the HTML form is < input type= "> in HTML. The type attribute of the input element can be of different types, which...

8 minutes read.

HTML <summary> tag

When we simply want to show the primary heading or topic name of hidden detailed material to users, then we can achieved this by using the summary tag. This makes it...

2 minutes read.

HTML Frames

Frames in Html is used to divide the browser into different sections where each section can load different Html documents. Collection of frame is known as Frameset. Creating frames:We use frameset...

2 minutes read.

HTML <u> tag

Underline Element/Tag: The u tag in html is used to specify the important text or phrase by underline. In earlier HTML versions, this element was known as the "Underline" element, and...

5 minutes read.

Font tag in HTML

HTML stands for Hypertext Mark-up Language and is used to create web pages and other information that can be later displayed in a web browser. It also consists of a...

4 minutes read.

HTML <table> tag

The Table element If we want to show the data and information in a two-dimensional table with rows and columns, then we can achieve this by using the HTML element <table>. Syntax: <body> <table> <thead> <tr> <thcolspan="#">………….</th> </tr> </thead> <tbody> <tr> <td>……….</td> <td>……….</td> </tr> </tbody> </table> </body> Example: <!DOCTYPE...

9 minutes read.

HTML City tag

HTML <City> tag HTML < cite > tag specifies a citation, a reference or title to a creative work, quoted content, books, websites, a research paper, a blog post, a painting,...

3 minutes read.

HTML <address> Tag

Hyper Text Markup Language, HTML is the best markup language for creating Web pages. HTML consists of a wide variety of elements. In all of these elements, one element is...

4 minutes read.