Header Ads

Breaking News
recent

HTML DOM Events


HTML DOM Events

HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document.
Events are normally used in combination with functions, and the function will not be executed before the event occurs (such as when a user clicks a button).
EventDescriptionBelongs To
abortThe event occurs when the loading of a media is abortedUiEventEvent
afterprintThe event occurs when a page has started printing, or if the print dialogue box has been closedEvent
animationendThe event occurs when a CSS animation has completedAnimationEvent
animationiterationThe event occurs when a CSS animation is repeatedAnimationEvent
animationstartThe event occurs when a CSS animation has startedAnimationEvent
beforeprintThe event occurs when a page is about to be printedEvent
beforeunloadThe event occurs before the document is about to be unloadedUiEventEvent
blurThe event occurs when an element loses focusFocusEvent
canplayThe event occurs when the browser can start playing the media (when it has buffered enough to begin)Event
canplaythroughThe event occurs when the browser can play through the media without stopping for bufferingEvent
changeThe event occurs when the content of a form element, the selection, or the checked state have changed (for <input>, <select>, and <textarea>)Event
clickThe event occurs when the user clicks on an elementMouseEvent
contextmenuThe event occurs when the user right-clicks on an element to open a context menuMouseEvent
copyThe event occurs when the user copies the content of an elementClipboardEvent
cutThe event occurs when the user cuts the content of an elementClipboardEvent
dblclickThe event occurs when the user double-clicks on an elementMouseEvent
dragThe event occurs when an element is being draggedDragEvent
dragendThe event occurs when the user has finished dragging an elementDragEvent
dragenterThe event occurs when the dragged element enters the drop targetDragEvent
dragleaveThe event occurs when the dragged element leaves the drop targetDragEvent
dragoverThe event occurs when the dragged element is over the drop targetDragEvent
dragstartThe event occurs when the user starts to drag an elementDragEvent
dropThe event occurs when the dragged element is dropped on the drop targetDragEvent
durationchangeThe event occurs when the duration of the media is changedEvent
endedThe event occurs when the media has reach the end (useful for messages like "thanks for listening")Event
errorThe event occurs when an error occurs while loading an external fileProgressEvent,UiEventEvent
focusThe event occurs when an element gets focusFocusEvent
focusinThe event occurs when an element is about to get focusFocusEvent
focusoutThe event occurs when an element is about to lose focusFocusEvent
fullscreenchangeThe event occurs when an element is displayed in fullscreen modeEvent
fullscreenerrorThe event occurs when an element can not be displayed in fullscreen modeEvent
hashchangeThe event occurs when there has been changes to the anchor part of a URLHashChangeEvent
inputThe event occurs when an element gets user inputInputEventEvent
invalidThe event occurs when an element is invalidEvent
keydownThe event occurs when the user is pressing a keyKeyboardEvent
keypressThe event occurs when the user presses a keyKeyboardEvent
keyupThe event occurs when the user releases a keyKeyboardEvent
loadThe event occurs when an object has loadedUiEventEvent
loadeddataThe event occurs when media data is loadedEvent
loadedmetadataThe event occurs when meta data (like dimensions and duration) are loadedEvent
loadstartThe event occurs when the browser starts looking for the specified mediaProgressEvent
messageThe event occurs when a message is received through the event sourceEvent
mousedownThe event occurs when the user presses a mouse button over an elementMouseEvent
mouseenterThe event occurs when the pointer is moved onto an elementMouseEvent
mouseleaveThe event occurs when the pointer is moved out of an elementMouseEvent
mousemoveThe event occurs when the pointer is moving while it is over an elementMouseEvent
mouseoverThe event occurs when the pointer is moved onto an element, or onto one of its childrenMouseEvent
mouseoutThe event occurs when a user moves the mouse pointer out of an element, or out of one of its childrenMouseEvent
mouseupThe event occurs when a user releases a mouse button over an elementMouseEvent
mousewheelDeprecated. Use the wheel event insteadWheelEvent
offlineThe event occurs when the browser starts to work offlineEvent
onlineThe event occurs when the browser starts to work onlineEvent
openThe event occurs when a connection with the event source is openedEvent
pagehideThe event occurs when the user navigates away from a webpagePageTransitionEvent
pageshowThe event occurs when the user navigates to a webpagePageTransitionEvent
pasteThe event occurs when the user pastes some content in an elementClipboardEvent
pauseThe event occurs when the media is paused either by the user or programmaticallyEvent
playThe event occurs when the media has been started or is no longer pausedEvent
playingThe event occurs when the media is playing after having been paused or stopped for bufferingEvent
popstateThe event occurs when the window's history changesPopStateEvent
progressThe event occurs when the browser is in the process of getting the media data (downloading the media)Event
ratechangeThe event occurs when the playing speed of the media is changedEvent
resizeThe event occurs when the document view is resizedUiEventEvent
resetThe event occurs when a form is resetEvent
scrollThe event occurs when an element's scrollbar is being scrolledUiEventEvent
searchThe event occurs when the user writes something in a search field (for <input="search">)Event
seekedThe event occurs when the user is finished moving/skipping to a new position in the mediaEvent
seekingThe event occurs when the user starts moving/skipping to a new position in the mediaEvent
selectThe event occurs after the user selects some text (for <input> and <textarea>)UiEventEvent
showThe event occurs when a <menu> element is shown as a context menuEvent
stalledThe event occurs when the browser is trying to get media data, but data is not availableEvent
storageThe event occurs when a Web Storage area is updatedStorageEvent
submitThe event occurs when a form is submittedEvent
suspendThe event occurs when the browser is intentionally not getting media dataEvent
timeupdateThe event occurs when the playing position has changed (like when the user fast forwards to a different point in the media)Event
toggleThe event occurs when the user opens or closes the <details> elementEvent
touchcancelThe event occurs when the touch is interruptedTouchEvent
touchendThe event occurs when a finger is removed from a touch screenTouchEvent
touchmoveThe event occurs when a finger is dragged across the screenTouchEvent
touchstartThe event occurs when a finger is placed on a touch screenTouchEvent
transitionendThe event occurs when a CSS transition has completedTransitionEvent
unloadThe event occurs once a page has unloaded (for <body>)UiEventEvent
volumechangeThe event occurs when the volume of the media has changed (includes setting the volume to "mute")Event
waitingThe event occurs when the media has paused but is expected to resume (like when the media pauses to buffer more data)Event
wheelThe event occurs when the mouse wheel rolls up or down over an elementWheelEvent

HTML DOM Event Properties and Methods

Property/MethodDescriptionBelongs To
altKeyReturns whether the "ALT" key was pressed when the mouse event was triggeredMouseEvent
altKeyReturns whether the "ALT" key was pressed when the key event was triggeredKeyboardEvent,TouchEvent
animationNameReturns the name of the animationAnimationEvent
bubblesReturns whether or not a specific event is a bubbling eventEvent
buttonReturns which mouse button was pressed when the mouse event was triggeredMouseEvent
buttonsReturns which mouse buttons were pressed when the mouse event was triggeredMouseEvent
cancelableReturns whether or not an event can have its default action preventedEvent
charCodeReturns the Unicode character code of the key that triggered the onkeypress eventKeyboardEvent
changeTouchesReturns a list of all the touch objects whose state changed between the previous touch and this touchTouchEvent
clientXReturns the horizontal coordinate of the mouse pointer, relative to the current window, when the mouse event was triggeredMouseEvent,TouchEvent
clientYReturns the vertical coordinate of the mouse pointer, relative to the current window, when the mouse event was triggeredMouseEvent,TouchEvent
clipboardDataReturns an object containing the data affected by the clipboard operationClipboardData
codeReturns the code of the key that triggered the eventKeyboardEvent
composedReturns whether the event is composed or notEvent
createEvent()Creates a new eventEvent
ctrlKeyReturns whether the "CTRL" key was pressed when the mouse event was triggeredMouseEvent
ctrlKeyReturns whether the "CTRL" key was pressed when the key event was triggeredKeyboardEvent,TouchEvent
currentTargetReturns the element whose event listeners triggered the eventEvent
dataReturns the inserted charactersInputEvent
dataTransferReturns an object containing the data being dragged/dropped, or inserted/deletedDragEventInputEvent
defaultPreventedReturns whether or not the preventDefault() method was called for the eventEvent
deltaXReturns the horizontal scroll amount of a mouse wheel (x-axis)WheelEvent
deltaYReturns the vertical scroll amount of a mouse wheel (y-axis)WheelEvent
deltaZReturns the scroll amount of a mouse wheel for the z-axisWheelEvent
deltaModeReturns a number that represents the unit of measurements for delta values (pixels, lines or pages)WheelEvent
detailReturns a number that indicates how many times the mouse was clickedUiEvent
elapsedTimeReturns the number of seconds an animation has been runningAnimationEvent
elapsedTimeReturns the number of seconds a transition has been running
eventPhaseReturns which phase of the event flow is currently being evaluatedEvent
getTargetRanges()Returns an array containing target ranges that will be affected by the insertion/deletionInputEvent
getModifierState()Returns an array containing target ranges that will be affected by the insertion/deletionMouseEvent
inputTypeReturns the type of the change (i.e "inserting" or "deleting")InputEvent
isComposingReturns whether the state of the event is composing or notInputEvent,KeyboardEvent
isTrustedReturns whether or not an event is trustedEvent
keyReturns the key value of the key represented by the eventKeyboardEvent
keyReturns the key of the changed storage itemStorageEvent
keyCodeReturns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup eventKeyboardEvent
locationReturns the location of a key on the keyboard or deviceKeyboardEvent
lengthComputableReturns whether the length of the progress can be computable or notProgressEvent
loadedReturns how much work has been loadedProgressEvent
metaKeyReturns whether the "META" key was pressed when an event was triggeredMouseEvent
metaKeyReturns whether the "meta" key was pressed when the key event was triggeredKeyboardEvent,TouchEvent
MovementXReturns the horizontal coordinate of the mouse pointer relative to the position of the last mousemove eventMouseEvent
MovementYReturns the vertical coordinate of the mouse pointer relative to the position of the last mousemove eventMouseEvent
newValueReturns the new value of the changed storage itemStorageEvent
newURLReturns the URL of the document, after the hash has been changedHasChangeEvent
offsetXReturns the horizontal coordinate of the mouse pointer relative to the position of the edge of the target elementMouseEvent
offsetYReturns the vertical coordinate of the mouse pointer relative to the position of the edge of the target elementMouseEvent
oldValueReturns the old value of the changed storage itemStorageEvent
oldURLReturns the URL of the document, before the hash was changedHasChangeEvent
onemptiedThe event occurs when something bad happens and the media file is suddenly unavailable (like unexpectedly disconnects)
pageXReturns the horizontal coordinate of the mouse pointer, relative to the document, when the mouse event was triggeredMouseEvent
pageYReturns the vertical coordinate of the mouse pointer, relative to the document, when the mouse event was triggeredMouseEvent
persistedReturns whether the webpage was cached by the browserPageTransitionEvent
preventDefault()Cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occurEvent
propertyNameReturns the name of the CSS property associated with the animation or transitionAnimationEvent,TransitionEvent
pseudoElementReturns the name of the pseudo-element of the animation or transitionAnimationEvent,TransitionEvent
regionMouseEvent
relatedTargetReturns the element related to the element that triggered the mouse eventMouseEvent
relatedTargetReturns the element related to the element that triggered the eventFocusEvent
repeatReturns whether a key is being hold down repeatedly, or notKeyboardEvent
screenXReturns the horizontal coordinate of the mouse pointer, relative to the screen, when an event was triggeredMouseEvent
screenYReturns the vertical coordinate of the mouse pointer, relative to the screen, when an event was triggeredMouseEvent
shiftKeyReturns whether the "SHIFT" key was pressed when an event was triggeredMouseEvent
shiftKeyReturns whether the "SHIFT" key was pressed when the key event was triggeredKeyboardEvent,TouchEvent
stateReturns an object containing a copy of the history entriesPopStateEvent
stopImmediatePropagation()Prevents other listeners of the same event from being calledEvent
stopPropagation()Prevents further propagation of an event during event flowEvent
storageAreaReturns an object representing the affected storage objectStorageEvent
targetReturns the element that triggered the eventEvent
targetTouchesReturns a list of all the touch objects that are in contact with the surface and where the touchstart event occured on the same target element as the current target elementTouchEvent
timeStampReturns the time (in milliseconds relative to the epoch) at which the event was createdEvent
totalReturns the total amount of work that will be loadedProgressEvent
touchesReturns a list of all the touch objects that are currently in contact with the surfaceTouchEvent
transitionendThe event occurs when a CSS transition has completedTransitionEvent
typeReturns the name of the eventEvent
urlReturns the URL of the changed item's documentStorageEvent
whichReturns which mouse button was pressed when the mouse event was triggeredMouseEvent
whichReturns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup eventKeyboardEvent
viewReturns a reference to the Window object where the event occurredUiEvent

No comments:

Powered by Blogger.