00 Votes

jQuery: Making DIV invisible (display:none)

Question by Guest | 2014-06-08 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
0Best Answer0 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.
2014-06-08 at 19:12

ReplyPositive Negative
Reply

Related Topics

jQuery: Show and hide elements

Tutorial | 0 Comments

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 article on askingbox.com. That’s how it’s done.