×

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 &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 &lt;datalist >Tag

The autocomplete feature in HTML files is provided by the <datalist> tag. It can be used in conjunction with an input tag to enable users to quickly fill out form...

4 minutes read.

How to change font in HTML

To give style to the content of your website, you may change the font of the text and make your website look attractive to the user. There are several methods which...

4 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.

HTML Images

HTML has <img> tag to display image on the web pages or web application. This tag is an empty tag i.e. we don't have to close this tag while using. SYNTAX: <img src="source address" attributes="alt, height, width"> Example: <html>   <body>   <center>Image tag Example</center>   <img src="https://www.tutorialandexample.com/resources/images/favicon.png"    alt="tutorialandexample"/>   </body>   </html> Output: Image...

1 minute read.

HTML &lt;body> alink Attribute

HTML <body> alink Attribute What is HTML? The HTML or HyperText Markup Language is used to design web pages. The file extension name for HTML file is ".html". It was released in...

2 minutes read.

HTML <br> tag

HTML is referred to as Hyper Text Markup Language, which is the most popular language for creating Web pages. HTML explains the construction of a Web page. It contains a...

4 minutes 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 Tutorial

Introduction This HTML tutorial helps beginners and professionals to learn HTML easily. HTML is a widely used web technology for website development. It stands for Hyper Text Markup Language. It is mainly used to...

7 minutes read.

HTML Headings

The titles and subtitles of our webpages are known as HTML headings. Let’s not talk about webpages but giving heading to almost everything like normal paragraphs, articles or let it...

2 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 Forms

Forms are required when we want to collect data from the user. Html forms consists of different fields to take user inputs such as: input, text area, checkbox, password, radio...

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.

Div Tag in HTML

In HTML, ‘div’ is a tag that specifies division or section in HTML document. But before going in detail of it, let’s first understand about tags in HTML. The tag...

8 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.

HTML <sub> tag

The sub element in HTML is used to describe one or more subscript texts. If The sub tag shows the text which is presented in a smaller font and below...

2 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 <style> tag

The section of information that we want to style is contained in html style tag. It includes CSS, which is used to design the text and images in the web page. Syntax: <head> <title>…………....

3 minutes read.

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...

4 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.