Question: ```
<div class='hide'>A</div>
<div class='hide'>B</div>
<div class='hide' id='1'>C</div>

```

I have a function called showOne which should hide all elements and then show the one with id='1'.

```
function showOne(id) {
// Hide all elements with class = 'hide'
$('#'+id).show();
}

```

How do I hide all elements with class = 'hide' in jquery?

Answer: 
You have to access elements by css class name. To do this use **.** operator

```
$('.hide').hide();

```

It will hide all divs.

Now show one div by id;

```
$('#elemID').show();

```

Or you can also do this by using 

```
$('.hide').eq(0).show();

```

It will show first div having class *hide*.
You can hide all components with class as hide using **.** 
 $('.hide').hide();