Search code examples
javascriptjqueryhtmlcss

How to hide <body> without DIV?


Thanks to anyone who solves/helps solving this request. Sorry if this is an impossible/previously asked request. I searched for it, couldn't find it, so posted a question.

So, the issue is, I want to hide using JS, but, I don't wanna use DIV tags to do so.

<body>
<div id="1">Content 1</div>
<div id="2">Content 2</div>
<div id="3">Content 3</div>
</body>

I know the possibilty of grouping the DIV's into a single DIV container, but just wanted to know, if it's possible without that, i.e., hiding the whole <body></body>

Thanks again.


Solution

  • It is possible with javascript like this:

    document.getElementsByTagName("BODY")[0].style.display = "none";
    

    jsFiddle here: http://jsfiddle.net/aq2ab77v/1/