HTMLElement.isShown method
HTMLElement › isShown
Official
Returns whether this element is shown, when the element is attached to the DOM and none of the parent and ancestor elements are hidden withdisplay: none.Exception: Does not work on
<body> and <html>, or on elements with position: fixed. Signature:
isShown(): booleanReturns: boolean — true if the element is shown, false otherwise.
Example:
const element = document.body.createEl('p');console.log(element.isShown()); // trueelement.hide();console.log(element.isShown()); // false