SHARE
TWEET

Overriding !important style using Javascript

a guest Feb 26th, 2012 24 Never
  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
RAW Paste Data
Top