NEW

6/recent/ticker-posts

Header Ads Widget

HTML Attributes


 

Global Attributes

HTML global attributes are those attributes which are common for all HTML elements. The global attributes are supported by both standard and non-standard element.

The global attributes can be used with all elements, although it may not have any effect on some elements.

Following is the complete list of global attributes with their description:

HereHTML Tags Listrepresent new in HTML5.

AttributesvalueDescription
accesskeycharacterIt is used to generate keyboard shortcuts for the current element.
classclassnameIt is used to provide the class name for the current element. It is mainly used with the stylesheet.
ContenteditableHTML Tags Listtrue
false
It determines whether the content within an element is editable or not.
contextmenumenu_idIt defines the id for the <menu> element which is used as a context menu (a menu appear on right click) for an element.
data-*HTML Tags ListsomevalueIt is used to store element-specific private data which can be accessed by Javascript.
dirrtl
ltr
auto
It specifies the direction of the content inside the current element.
draggableHTML Tags Listtrue
false
auto
It specifies whether the content within an element is movable or not using Drag and Drop API.
dropzoneHTML Tags Listcopy
move
link
It specifies the action is taken on the dragged element when it is dropped, ¬¬ such as whether it is copied, moved or linked.
hiddenHTML Tags ListIt is used to hide the element from view.
ididIt specifies a unique id for the element. It can be used with CSS and JavaScript.
langlanguage_codeIt specifies the primary language for the content of an element.
stylestyleIt is used to apply inline CSS to the current element.
spellcheckHTML Tags Listtrue
false
It specifies whether the content should be checked for spelling errors or not.
tabindexnumberIt determines the tabbing order of an element.
titletextIt is used to provide the title, name, or some extra information about the element.
translateHTML Tags Listyes
no
It specifies whether the content of the element should be translated when the page is localized or not.



HTML Event Attributes

When a browser reacts on user action, then it is called as an event. For example, when you click on the submit button, then if the browser displays an information box.

In HTML5 there are lots of event attributes available which can be activated using a programming language such as JavaScript.

Following is a table of event attributes, using these attributes you can perform several events.

Windows Event Attributes

Windows events are related for the window object, and it can only be applied with <body> tag.

AttributeDescription
onafterprintExecuted the script after the document is printed.
onbeforeprintExecuted the script before the document is printed.
onbeforeunloadExecuted the script before a document being unloaded.
onerrorExecuted the script when an error occurs.
onhashchangeExecuted the script when the anchor part in URL of the webpage is changed.
onloadExecuted the script when the webpage is entirely loaded.
onmessageExecuted the script when a message event occurs.
onofflineExecuted the script when the network connection is disconnected, and browser started working offline.
ononlineExecuted the script when the browser started working online
onpagehideExecuted the script when the current webpage is hidden such as if the user has moved away from the current webpage.
onpageshowExecuted the script when the current webpage is focused.
onpopstateExecuted the script when the window's active history is changed.
onresizeExecuted the script when the window is resized.
onstorageExecuted the script when web storage is updated.
onunloadExecuted the script when the current webpage is unloaded, or window is closed.

Form Event Attributes

Form event occurs when the user performs some action within the form such as submitting the form, selecting input field, etc.

The form events can be used with any element, but these are mainly used with HTML form elements.

Following is the list of all Form Event attributes:

AttributeDescription
onblurExecuted the script when form element loses the focus.
onchangeExecuted the script when the value of the element is changed.
onfocusTrigger an event when the element gets focused.
oninputExecuted the script when the user enters input to the element.
oninvalidExecuted the script when the element does not satisfy its predefined constraints.
onresetTriggers the event when user reset the form element values.
onsearchTriggers the event when a search field receives some input.
onselectTriggers the event when the user has selected some text.
onsubmitTriggers the event when a form is submitted.

Keyboard Event Attributes

Keyboard event occurs when a user interacts with the keyboard. Following is a list of the Keyboard event.

AttributeDescription
onkeydownTriggers the event when the user presses down a key on the keyboard.
onkeypressTrigger the event when the user presses the key which displays some character.
onkeyupTrigger the event when the user releases the currently pressed key.

Mouse Event Attributes

AttributeDescription
onclickTrigger the event when the mouse clicks on the element.
ondblclickTrigger the event when mouse double-click occurs on the element.
onmousedownTrigger the event when the mouse button is pressed on the element.
onmousemoveTrigger the event when the mouse pointer moves over the element.
onmouseoutTrigger the event when the mouse moves outside the element.
onmouseoverTrigger the event when the mouse moves onto the element.
onmouseupTrigger the event when the mouse button is released.
onmousewheelDeprecated. Use the onwheel attribute.
onwheelTrigger the event when the mouse wheel rolls up or down on the element

Clipboard Event Attributes

AttributeDescription
oncopyTrigger the event when the user copies the content to the system clipboard.
oncutTrigger the event when the content of an element is cut and copy to the clipboard.
onpasteTrigger the event when the user pastes some content in an element.

Media Event Attributes

AttributeDescription
onabortExecuted the script when media playback is aborted.
oncanplayExecuted the script when the media file is ready to play.
oncanplaythroughExecuted the script when the media file is ready to play without buffering or stopping.
oncuechangeExecuted the script text cue of <track> element is changed.
ondurationchangeExecuted the script when the media file duration is changed.
onemptiedExecuted the script if media occurs some fatal error, and the file becomes unavailable.
onendedExecuted the script when the media file occurs its end point.
onerrorExecuted the script when some error occurred while fetching the media data.
onloadeddataExecuted the script when media data is loaded.
onloadedmetadataExecuted the script when metadata of media file is loaded.
onloadstartExecuted the script when loading of media file starts.
onpauseExecuted the script when media playback is paused.
onplayExecuted the script when media file ready to play after being paused.
onplayingExecuted the script when media file is started playing.
onprogressExecuted the script when the browser is in the process of getting the media data.
onratechangeExecuted the script when playback speed changed.
onseekedExecuted the script when seek operation is ended and seeking attribute is set to false.
onseekingExecuted the script when seek operation is active and seeking attribute is set to true.
onstalledExecuted the script when browser unexpectedly stopped fetching the data media.
onsuspendExecuted the script if fetching of media data is intentionally stopped.
ontimeupdateExecuted the script when playback position is changed, such as if a user fasts forward the track.
onvolumechangeExecuted the script when media volume is changed (muted or unmuted).
onwaitingExecuted the script if playback pause to wait for loading more data





Post a Comment

0 Comments

Recents Post

Exploring Paidwork - Your Gateway to Earning Online