{"id":20090,"date":"2022-10-06T03:49:50","date_gmt":"2022-10-06T03:49:50","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=9253"},"modified":"2022-10-06T03:49:50","modified_gmt":"2022-10-06T03:49:50","slug":"global-event-attributes","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/10\/06\/global-event-attributes\/","title":{"rendered":"Global Event Attributes"},"content":{"rendered":"\n<p>An event occurs when the browser reacts to a particular action of the user. The user generates an event when clicking on a mouse, playing video, uploading a document or an image, or performing other actions on a website.<\/p>\n\n\n\n<p>To react to an event, a handler is assigned to it. A handler is a way to run script (e.g., JavaScript) in case of user actions. There are many ways of attaching a handler, and one of them is setting it in HTML with attributes.<\/p>\n\n\n\n<p>Below, you can find a table of event attributes used to initiate specific actions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"window-events-attributes-2\">Window Events Attributes<\/h2>\n\n\n\n<p>Window events are triggered for the window object. The attributes are applicable only to the\u00a0&lt;body>\u00a0tag.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>onafterprint<\/td><td>Executed when the document is printed.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onbeforeprint<\/td><td>Executed before the document is printed.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onbeforeunload<\/td><td>Executed when the document is about to get unloaded (when a user is about to quit the page before it is loaded).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onblur<\/td><td>Executed when a window loses focus.<\/td><\/tr><tr><td>onerror<\/td><td>Executed when an error occurs when downloading the document.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onhashchange<\/td><td>Executed when the anchor in URL of a web page is changed (anchor comes after #).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onload<\/td><td>Executed when content of a web page (images,\u00a0CSS styles\u00a0and scripts) is entirely loaded.<\/td><\/tr><tr><td>onmessage<\/td><td>Executed when a message is triggered.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onoffline<\/td><td>Executed when the browser works offline.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ononline<\/td><td>Executed when the browser works online.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onpagehide<\/td><td>Executed when a user go away from the web page.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onpageshow<\/td><td>Executed when a user navigates to a web page.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onpopstate<\/td><td>Executed when the window&#8217;s history is changed.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onredo<\/td><td>Executed when a \u201cRedo\u201d option is used ( the last action is reversed).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onresize<\/td><td>Executed when a window is resized.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onstorage<\/td><td>Executed when a web storage is updated.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onundo<\/td><td>Executed when the last action is cancelled (\u201cundo\u201d command).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onunload<\/td><td>Executed when a web page is unloaded (closed).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"form-events-attributes-5\">Form Events Attributes<\/h2>\n\n\n\n<p>An event that can occur within a form is called a form event. Form events happen when a user opens or closes a form, moves between forms, or works with data on a form.<\/p>\n\n\n\n<p>Form events attributes can be applied to all HTML elements, but they are generally used with HTML forms elements.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>onblur<\/td><td>Executed when a form element loses focus.<\/td><\/tr><tr><td>onchange<\/td><td>Executed when the value of the element is changed.<\/td><\/tr><tr><td>oncontextmenu<\/td><td>Executed when the context menu is shown.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onfocus<\/td><td>Executed when an element gets focus.<\/td><\/tr><tr><td>oninput<\/td><td>Executed when an element gets user input.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>oninvalid<\/td><td>Executed if an input element is invalid.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onreset<\/td><td>Executed when a form is reset (all controls within the form are set to their initial values).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onsearch<\/td><td>Executed when the user writes something in a search field (for &lt;input=&#8221;search&#8221;&gt;).<\/td><\/tr><tr><td>onselect<\/td><td>Executed when some text is selected in an element.<\/td><\/tr><tr><td>onsubmit<\/td><td>Executed when a form is sent.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"keyboard-events-attributes-7\">Keyboard Events Attributes<\/h2>\n\n\n\n<p>The keyboard event attributes can be applied to all HTML elements.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>onkeydown<\/td><td>Executed when the user is pressing any key on the keyboard.<\/td><\/tr><tr><td>onkeypress<\/td><td>Executed when the user has pressed a key on the keyboard. (doesn\u2019t work with Alt, Ctrl, Shift, Esc, PrScr).<\/td><\/tr><tr><td>onkeyup<\/td><td>Executed when a pressed key is released.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mouse-event-attributes-9\">Mouse Event Attributes<\/h2>\n\n\n\n<p>Mouse events occur when the mouse interacts with the HTML document. The attributes can be applied to all HTML elements.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>onclick<\/td><td>Executed when a mouse-button is clicked.<\/td><\/tr><tr><td>ondblclick<\/td><td>Executed when a mouse-button is clicked twice.<\/td><\/tr><tr><td>ondrag<\/td><td>Executed when an element is being dragged.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ondragend<\/td><td>Executed when an element has been dragged.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ondragenter<\/td><td>Executed when a dragged element enters a valid drop target.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ondragleave<\/td><td>Executed when a dragged element leaves a valid drop target.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ondragover<\/td><td>Executed when a dragged element being dragged over a valid drops target (every few hundred milliseconds).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ondragstart<\/td><td>Executed when the user starts dragging an element.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ondrop<\/td><td>Executed when the user drops dragging an element.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onmousedown<\/td><td>Executed when a mouse button is pressed.<\/td><\/tr><tr><td>onmousemove<\/td><td>Executed when the mouse pointer is moved onto the element.<\/td><\/tr><tr><td>onmouseout<\/td><td>Executed when the mouse pointer moves out of an element.<\/td><\/tr><tr><td>onmouseover<\/td><td>Executed when the mouse pointer is moved onto an element.<\/td><\/tr><tr><td>onmouseup<\/td><td>Executed when a mouse button is released.<\/td><\/tr><tr><td>onmousewheel<\/td><td>Executed when the mouse wheel rolls up or down over an element.<br><strong>Obsolete attribute (use onwheel attribute instead).<\/strong><\/td><\/tr><tr><td>onscroll<\/td><td>Executed when an element&#8217;s scrollbar is being scrolled.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onwheel<\/td><td>Executed when the mouse wheel rolls up or down over an element.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"clipboard-event-attributes-11\">Clipboard Event Attributes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>oncopy<\/td><td>Executed when the content of an element is copied.<\/td><\/tr><tr><td>oncut<\/td><td>Executed when the content of an element is cut.<\/td><\/tr><tr><td>onpaste<\/td><td>Executed when the content of an element is pasted.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"media-files-events-attributes-13\">Media-files Events Attributes<\/h2>\n\n\n\n<p>Media-files events occur in media elements, like video, image, audio. The attributes can be applied to any HTML element, but they are generally used within\u00a0audio,\u00a0embed,\u00a0img,\u00a0object\u00a0and\u00a0video\u00a0elements.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>onabort<\/td><td>Executed when the loading of an audio\/video is aborted.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>oncanplay<\/td><td>Executed when the file is ready to start playing (has buffered enough to start playing).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>oncanplaythrough<\/td><td>Executed when the file is ready to be played from start to end without stopping for buffering.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>oncuechange<\/td><td>Executed when the duration of the media is changed.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onemptied<\/td><td>Executed when something happens and the file is unavailable (e.g., when the Internet connection is lost).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onended<\/td><td>Executed when a media file reached the end.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onerror<\/td><td>Executed when an error occurs when the file is being loaded.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onloadeddata<\/td><td>Executed when media data is loaded.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onloadedmetadata<\/td><td>Executed when metadata (size of media files, duration, etc. ) is loaded.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onloadstart<\/td><td>Executed when the browser starts downloading media data.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onpause<\/td><td>Executed when the mediafile is paused.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onplay<\/td><td>Executed when the file is ready to start playing.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onplaying<\/td><td>Executed when the file starts playing.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onprogress<\/td><td>Executed when the browser is in process of getting media data.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onratechange<\/td><td>Executed each time, when the playing mode is changed (e.g. user switches fast forward or slow motion mode).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onseeked<\/td><td>Executed when the seeking attribute of the &lt;audio&gt; or &lt;video&gt; tags is set to false indicating that seeking has ended.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onseeking<\/td><td>Executed when the seeking attribute of the &lt;audio&gt; or &lt;video&gt; tags is set to false indicating that seeking is active.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onstalled<\/td><td>Executed when the browser cannot get media data for whatever reason.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onsuspend<\/td><td>Executed when the browser has already started extracting media data, but the process was suspended before the data is completely loaded.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ontimeupdate<\/td><td>Executed when the playing position is changed.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onvolumechange<\/td><td>Executed each time when the volume is changed (includes setting the volume to &#8220;mute&#8221;).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>onwaiting<\/td><td>Executed when media file is suspended, but is about to resume (e.g., when the file is paused for buffering).<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"other-events-attributes-15\">Other Events Attributes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>onerror<\/td><td>Executed when an error occurs when downloading external file.<\/td><\/tr><tr><td>onshow<\/td><td>Executed when the\u00a0&lt;menu>\u00a0is shown as a context menu.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><tr><td>ontoggle<\/td><td>Executed when a user opens or closes the\u00a0&lt;details>.<br><strong>New attribute in HTML5.<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>An event occurs when the browser reacts to a particular action of the user. The user generates an event when clicking on a mouse, playing video, uploading a document or an image, or performing other actions on a website. To react to an event, a handler is assigned to it. A handler is a way [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[529],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/20090"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=20090"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/20090\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=20090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=20090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=20090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}