Useful Javascript snippets

Test if an element exists before using it

Vanilla JS equivalent to jQuery.ready()

 

Quickly Enable/Disable Javascript (Chrome)

  • open developer tools
  • Cmd + Shift + p
  • type: javascript
  • click enable / disable Javascript