×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Randy Marsh
Added: Jan 29, 2014 11:08 PM
Views: 22
Tags: no tags
  1. (function() {
  2.  
  3. var buttons = document.getElementsByTagName("button");
  4.  
  5. for (var i = 0, len = buttons.length; i < len; i = i + 1) {
  6.     buttons[i].onclick = function() {
  7.         var className = this.innerHTML.toLowerCase();
  8.        
  9.         document.body.className = className;
  10.     };
  11.    
  12. }
  13.  
  14. }());
  15.