How to set display property inline with !important
css, inline, javascript, styles
Solution
I think it will help you:
element.style.cssText += ';display:block !important;'
Problem
I want to write an inline style viz `block !important` using javascript code. Code looks like this ``` element.style.display = 'block !important'; // This does not work (Approach 1) ``` However, ``` element.style = 'display:block !important'; // works perfectly (Approach 2) ``` But Approach 2 is not acceptable for the obvious reason it will over-ride earlier inline styles. You can see this in this DEMO at Jsbin Q1: How can I set `display: block !important` property using javascript and it has to be inline. Q2: I want to know why Approach1 does not work ?