Is it possible to conditionally add a class to an element based on its display property (eg. display: block, display: none) in JavaScript?
I'm guessing it would look something like this:
.addClass($invoiceTable.display=block ? "firstClass" : "secondClass");
where firstClass is added if invoiceTable has style="display: block", else the secondClass is added.
$invoiceTable.display=blockwell that is not a comparison. So look at the display property or getComputedStylestyleproperty so, assuming$invoiceTableis anHTMLElement,$invoiceTable.style.display === 'block'.styleproperty of an element only contains its inline styles, not styles inherited from CSS. UsegetComputedStyle()to get its actual style.