0 0 Votes

jQuery: Making DIV invisible (display:none)

Question by Guest | 08/06/2014 at 17:31

I would like to hide one of my DIV containers on my website with the help of JavaScript (jQuery). In other words, I would like to set the CSS property "display" to the value "none". Is there any code available for this purpose?

ReplyPositiveNegative

Anja Proggy

Show Profile | Message
Avatar
0Best Answer
0 Votes

Spontaneously, I can think of two possibilities.

Here is my DIV in HTML code with the ID "mydiv":

<div id="mydiv"></div>

And here is the first way:

$("#mydiv").hide();

Alternatively, using the second way, you can directly set the CSS:

$("#mydiv").css("display","none");

By the way: Using .show() you can make your DIV visible again and with .toggle() you are able to switch between visible and invisible with each call of the function.
08/06/2014 at 19:12

ReplyPositive Negative
Reply

Related Topics

jQuery: Show and hide elements
Tutorial | 0 Comments
jQuery: Add Content to DIV
Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own articles on askingbox.com. How to do.