Want more features on Pastebin? Sign Up, it's FREE!
Guest

Overriding !important style using Javascript

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.83 KB  |  views: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. td.EvenRow a{
  2.   display: none !important;
  3. }
  4.        
  5. element.style.display = "inline";
  6.        
  7. element.style.display = "inline !important";
  8.        
  9. function addNewStyle(newStyle) {
  10.     var styleElement = document.getElementById('styles_js');
  11.     if (!styleElement) {
  12.         styleElement = document.createElement('style');
  13.         styleElement.type = 'text/css';
  14.         styleElement.id = 'styles_js';
  15.         document.getElementsByTagName('head')[0].appendChild(styleElement);
  16.     }
  17.     styleElement.appendChild(document.createTextNode(newStyle));
  18. }
  19.  
  20. addNewStyle('td.EvenRow a {display:inline !important;}')
  21.        
  22. element.setAttribute('style', 'display:inline !important');
  23.        
  24. element.style.cssText = 'display:inline !important';
  25.        
  26. element.style.setProperty("display", "inline", "important")
  27.        
  28. element.className = null; // or your favorite replacement class
clone this paste RAW Paste Data