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: 
Try something like:

```
function showOne(id) {
    $('.hide').not('#' + id).hide();
}

showOne(1);​

```

Demo: <http://jsfiddle.net/aymansafadi/kReZn/>

I agree with @TheSystemRestart though, "NOTE: DON'T USE ONLY NUMERIC ID".
```
$('div.hide').hide(300,function() {  // first hide all `.hide`
   $('#'+ id +'.hide').show(); // then show the element with id `#1`
});

```

***NOTE: DON'T USE ONLY NUMERIC ID. NOT PERMITTED. [READ THIS](https://stackoverflow.com/questions/7987636/why-cant-i-have-a-numeric-value-as-the-id-of-an-element)***