daniel__
daniel__

Reputation: 11845

hide various divs -jquery

It is possible join this code, in something less redundant?

$('#x').hide();
$('#y').hide();
$('#z').hide();

i already tried $('#x', '#y', '#z').hide(); but didn't work.

thanks

Upvotes: 0

Views: 78

Answers (2)

mbrevoort
mbrevoort

Reputation: 5165

This should work:

$('#x, #y, #z').hide();

http://api.jquery.com/multiple-selector/

Upvotes: 7

Matty K
Matty K

Reputation: 3891

Have you tried:

$('#x, #y, #z').hide();

Upvotes: 5

Related Questions