Grow your CSS skills. Land your dream job.

Last updated on:

Get All Possible DOM Events

You can get an array of all the events that start with "on" (e.g. onclick) by running this in the Console of Firefox.

[i for(i in document)].filter(function(i){return i.substring(0,2)=='on'&&(document[i]==null||typeof document[i]=='function');})

You'll get an array like this (Firefox 23):

["onreadystatechange", "onmouseenter", "onmouseleave", "onwheel", "oncopy", "oncut", "onpaste", "onbeforescriptexecute", "onafterscriptexecute", "onabort", "oncanplay", "oncanplaythrough", "onchange", "onclick", "oncontextmenu", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onloadeddata", "onloadedmetadata", "onloadstart", "onmousedown", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onpause", "onplay", "onplaying", "onprogress", "onratechange", "onreset", "onseeked", "onseeking", "onselect", "onshow", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "onvolumechange", "onwaiting", "onmozfullscreenchange", "onmozfullscreenerror", "onmozpointerlockchange", "onmozpointerlockerror", "onblur", "onerror", "onfocus", "onload", "onscroll"]

Firefox, because it supports array comprehension which that little snippet uses.

Reference URL


  1. name
    Permalink to comment#

    Too bad nobody uses firefox anymore.

    • surname
      Permalink to comment#

      Wrong, a lot of people are using Firefox! Chrome is to good, it will tell you that your site is perfect. When you’ll try it on IE all hell will break loose. On Firefox with developer toolbar and firebug you are all set! My friend uses Chrome to test his stuff and a lot of the times he does JS errors! Maybe if you are a normal user, Chrome it’s OK, if you are a web developer then I recommend Firefox.

  2. Simon
    Permalink to comment#

    Thanks :)

Leave a Comment

Posting Code

  • Use Markdown, and it will escape the code for you, like `<div class="cool">`.
  • Use triple-backticks for blocks of code.
      <h1>multi-line block of code</h1>
      <span>be cool yo.</span>
  • Otherwise, escape your code, like <code>&lt;div class="cool"&gt;</code>. Markdown is just easier though.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".