...">

Hide div with class name with space in it using jquery

<div class="rcbScroll rcbWidth rcbNoWrap" style="height: 200px; width: 100%; overflow: auto"> </div> 

This is my div. I want to hide the div using the class name. I cannot name the class name as a space in it. This is only one class.

+4
source share
3 answers

Class names cannot contain spaces. Therefore, you should think of it as two class names.

For example: class="word1 word2"

It can be selected with the following:

 var myVar = $('.word1.word2'); 

In your specific case, it will be:

 $('.rcbScroll.rcbWidth.rcbNoWrap').hide(); 
+8
source

You can use a dot to combine several classes into a selector, separated by a space character.

Live demo

 $(".rcbScroll.rcbWidth.rcbNoWrap").hide(); 
+2
source

Spaces mean several class names, you can use any of these classes to hide the div .

Example:

 $(".rcbScroll").hide() 
+2
source

All Articles