Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js events

Events:

Mouse:
onclick
The event occurs when the user clicks on an element
oncontextmenu
User right-clicks on an element to open a context menu
ondblclick
The user double-clicks on an element
onmousedown
User presses a mouse button over an element
onmouseenter
The pointer moves onto an element
onmouseleave
Pointer moves out of an element
onmousemove
The pointer is moving while it is over an element
onmouseover
When the pointer is moved onto an element or one of its children
onmouseout
User moves the mouse pointer out of an element or one of its children
onmouseup
The user releases a mouse button while over an element

Keyboard:
onkeydown
When the user is pressing a key down
onkeypress
The moment the user starts pressing a key
onkeyup
The user releases a key

Frame:
onabort
The loading of a media is aborted
onbeforeunload
Event occurs before the document is about to be unloaded
onerror
An error occurs while loading an external file
onhashchange
There have been changes to the anchor part of a URL
onload
When an object has loaded
onpagehide
The user navigates away from a webpage
onpageshow
When the user navigates to a webpage
onresize
The document view is resized
onscroll
An element’s scrollbar is being scrolled
onunload
Event occurs when a page has unloaded

Form:
onblur
When an element loses focus
onchange
The content of a form element changes (for <input>, <select>and <textarea>)
onfocus
An element gets focus
onfocusin
When an element is about to get focus
onfocusout
The element is about to lose focus
oninput
User input on an element
oninvalid
An element is invalid
onreset
A form is reset
onsearch
The user writes something in a search field (for <input="search">)
onselect
The user selects some text (for <input> and <textarea>)
onsubmit
A form is submitted

Drag:
ondrag
An element is dragged
ondragend
The user has finished dragging the element
ondragenter
The dragged element enters a drop target
ondragleave
A dragged element leaves the drop target
ondragover
The dragged element is on top of the drop target
ondragstart
User starts to drag an element
ondrop
Dragged element is dropped on the drop target

Clipboard:
oncopy
User copies the content of an element
oncut
The user cuts an element’s content
onpaste
A user pastes content in an element

Media:
onabort
Media loading is aborted
oncanplay
The browser can start playing media (e.g. a file has buffered enough)
oncanplaythrough
When browser can play through media without stopping
ondurationchange
The duration of the media changes
onended
The media has reached its end
onerror
Happens when an error occurs while loading an external file
onloadeddata
Media data is loaded
onloadedmetadata
Meta Metadata (like dimensions and duration) are loaded
onloadstart
Browser starts looking for specified media
onpause
Media is paused either by the user or automatically
onplay
The media has been started or is no longer paused
onplaying
Media is playing after having been paused or stopped for buffering
onprogress
Browser is in the process of downloading the media
onratechange
The playing speed of the media changes
onseeked
User is finished moving/skipping to a new position in the media
onseeking
The user starts moving/skipping
onstalled
The browser is trying to load the media but it is not available
onsuspend
Browser is intentionally not loading media
ontimeupdate
The playing position has changed (e.g. because of fast forward)
onvolumechange
Media volume has changed (including mute)
onwaiting
Media paused but expected to resume (for example, buffering)
Animation
animationend
A CSS animation is complete
animationiteration
CSS animation is repeated
animationstart
CSS animation has started

Other:
transitionend
Fired when a CSS transition has completed
onmessage
A message is received through the event source
onoffline
Browser starts to work offline
ononline
The browser starts to work online
onpopstate
When the window’s history changes
onshow
A <menu> element is shown as a context menu
onstorage
A Web Storage area is updated
ontoggle
The user opens or closes the <details> element
onwheel
Mouse wheel rolls up or down over an element
ontouchcancel
Screen touch is interrupted
ontouchend
User finger is removed from a touch screen
ontouchmove
A finger is dragged across the screen
ontouchstart
Finger is placed on touch screen
Comment

javascript events

document.querySelector('html').onclick = function() {
    alert('Ouch! Stop poking me!');
}
Comment

events in javascript

Events are things browser or user do it like click,scroll,press keyboard.
const button =document.querySelector('#submit)
 //Click,Scroll,Resizing the browser
 button.addEventListener('click', function(){
console.log('New Item added'); //when button with id #submit click it console.log
})
Comment

events in javascript

//this is an event detector for a mouseclick with Jquery
$('#id').on('click',function(){
    yourFunction(args);
});
Comment

javascript event

// An event is triggered when a user clicks on the #button element,
// which then sets the #button element's background-color to blue. 
$('#button').on('click', event => {
  $(event.currentTarget).css('background-color', 'blue');  
});
Comment

events js

import { EventEmitter } from "node:events";
/**
 * add "type":"module" in package.json
 */

class MyEmitter extends EventEmitter {}

const myEvent = new MyEmitter();

myEvent.on("event", () => {
  console.log("an event occurred!");
});

myEvent.emit("event");
Comment

javascripts events

let array_1 = [1, 2, 3, 4, 5, 6];
Comment

PREVIOUS NEXT
Code Example
Javascript :: change theme in react-toastify 
Javascript :: vue 3 computed 
Javascript :: how to instance in a node with code godot 
Javascript :: javascript download xlsx file 
Javascript :: javascript format number 2 digits 
Javascript :: angular refresh token 
Javascript :: miles to metres 
Javascript :: generating random number in javascript 
Javascript :: javascript get element by multiple class names 
Javascript :: axios cancel previous request 
Javascript :: electron disable menu 
Javascript :: express routing 
Javascript :: javaSript string first words to upper case 
Javascript :: find max days of month js 
Javascript :: react refresh 404 error 
Javascript :: convert days into year, Month, days 
Javascript :: loop over string js 
Javascript :: react fetch custom hook 
Javascript :: js check if is array 
Javascript :: remove double quotes from json array javascript 
Javascript :: regex exact match case insensitive 
Javascript :: regex is not empty string 
Javascript :: stop submit form jquery 
Javascript :: jquery button top to bottom 
Javascript :: React JS CDN Links 
Javascript :: js print array without comma 
Javascript :: Too long with no output (exceeded 10m0s): context deadline exceeded 
Javascript :: scrolltop in javascript 
Javascript :: How to access return value of promise 
Javascript :: how to send query parameters in url vuejs 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =