HTML DOM Document hidden Property
The Document hidden property returns a Boolean value indicating if the page is considered hidden or not. This is a read-only property.
Syntax:
let bool = document.hidden;
Return Value: This property returns a Boolean Value.
- true if the page is considered hidden.
- false if the page is not considered hidden
Example: This example shows how to use this property to check whether the page is hidden or not.
HTML
<!DOCTYPE html>
< html >
< body >
< h1 >GeeksforGeeks</ h1 >
< button onclick = "get()" >
Check
</ button >
< script type = "text/javascript" >
function get() {
alert(document.hidden);
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome 33
- Edge 12
- Internet Explorer 10
- Firefox 18
- Opera 12.1
- Safari 7
Last Updated :
19 Jun, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...