开发者

Is this valid in jquery?

开发者 https://www.devze.com 2023-01-07 06:18 出处:网络
I am showing three divs using jquery using this, $(\"#ImageButtonDiv\").show(); 开发者_如何学JAVA$(\"#ResultsDiv\").show();

I am showing three divs using jquery using this,

$("#ImageButtonDiv").show();
开发者_如何学JAVA$("#ResultsDiv").show();
$("#PagerDown").show();

Is my following statement valid?

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

Any suggestion...


No. You do this instead:

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

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


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消