HTMLElement.toggle method
HTMLElement › toggle
Official
Toggles the visibility of the element using cssdisplay property. Signature:
toggle(show: boolean): voidParameters:
| Parameter | Type | Description |
|---|---|---|
| show | boolean | Whether to show the element. |
Returns: void
Example:
document.body.toggle(true);document.body.toggle(false);