I have an interactive page that changes td background color dynamically, with javascript. Without any style, this page works fine. As a style requirement, table background color should be black, and td background should be white. But due to cascade rules, dynamic changes have lower priority, so javascript is not able to override static style. How can I solve this? Thanks.
Sample 1:
cell.style.cssText = "background-color: gray;" // it works fine
Sample 2:
table {
background-color:black;
}
td {
background-color: white;
}
cell.style.cssText = "background-color: gray;" // it does not work anymore, even with "!important;"