sggexchange
asked on
javascript set a style as !important without relying in changing the className
How can I set a style as "!important" using javascript without relying in changing the className and doing it that way?
ASKER
I don't want to use the className approach because I want to change font-size and line-height passing a variable.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think you can actually. I do not have a link at hand
Did anyone ever figured this out?
Did scrathcyboy's suggestion not work for you?
I found a way to do this. Use the cssText property of objects. For instance:
myElement.cssText = "inline !important";
cssText allows you to set a whole string with the style.
myElement.cssText = "inline !important";
cssText allows you to set a whole string with the style.
Why not change className?