tags:

views:

53

answers:

2

I am showing three divs using jquery using this,

$("#ImageButtonDiv").show();
$("#ResultsDiv").show();
$("#PagerDown").show();

Is my following statement valid?

$("#ImageButtonDiv #ResultsDiv #PagerDown").show();

Any suggestion...

+7  A: 

No. You do this instead:

$("#ImageButtonDiv, #ResultsDiv, #PagerDown").show();

When using multiple selectors, you much separate each with a comma ,.

GenericTypeTea
+1  A: 

Just because it's possible:

$("#ImageButtonDiv #ResultsDiv #PagerDown".split(' ').join(',')).show();

But, returning to seriousness, sticking to a D.R.Y. I would use a class for all those elements and just call

$('.my_beautiful_class').show();
jAndy
Are you missing a close bracket there?
GenericTypeTea
Why would anyone do that?! Cool anyway :)
Makram Saleh
@GenericTypeTea: nope, should be fine.@Makram: I don't have a clue actually, maybe in a land before time, some backend developer sent a string with identifiers sepperated with whitespaces? I don't know :)
jAndy
@jAndy - My mistake.
GenericTypeTea