Tom
Tom

Reputation: 6707

How to hide a div with jQuery?

How to hide the following div with jQuery?

HTML:

    <div class="BottomSmMargin MiniCheckDiv">

Upvotes: 3

Views: 341

Answers (5)

nottombrown
nottombrown

Reputation: 535

If you're having problems, your DOM may not be ready. Make sure that you put it within the document ready handler.

$(document).ready(function(){
    $('.BottomSmMargin.MiniCheckDiv').hide();
});

Upvotes: 1

Delan Azabani
Delan Azabani

Reputation: 81492

$('.BottomSmMargin.MiniCheckDiv').hide();

Notice there is no space between the two classes here.

Upvotes: 8

DarkLeafyGreen
DarkLeafyGreen

Reputation: 70466

Always useful: have a look at the jQuery API site. There you can find the following functions:

.hide()

and

.toggle()

Upvotes: 1

jensgram
jensgram

Reputation: 31518

Depends on what you can use to qualify (the selector), but hide() (or toggle()) is probably what you're looking for.

$('div.BottomSmMargin').hide();
// or
$('div.MiniCheckDiv').hide();
// or both
$('div.BottomSmMargin').hasClass('MiniCheckDiv').hide();

Upvotes: 3

m.edmondson
m.edmondson

Reputation: 30922

http://api.jquery.com/hide/

Upvotes: 3

Related Questions