Detect JavaScript, switch class


/ Published in: JavaScript
Save to your folder(s)

Detects JavaScript and switches class.

From an example given by [Paul Irish]('http://paulirish.com/perf/')


Copy this code and paste it in your HTML
  1. // HTML
  2. <html class="no-js">…<html>
  3.  
  4. // JS
  5. (function(H,C){H[C]=H[C].replace(/\bno-js\b/, 'js')})
  6. (document.documentElement, 'className')

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.