code

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

RSS20
Follow by Email
Facebook20
Pinterest9