开发者

How can I pass a variable and a string into the same jQuery selector?

I have the following:

var x = '.'+this.id;  

and this does not work:

$(x,'#thumb').show();

but this does:

$(x).show();

and obviously so does this:

$('#thumb').show();

What am I missing? Should I be doing something else in gener开发者_如何学Pythonal to pass variables (even on their own) through jQuery?


You need to concatenate the two strings together:

$(x+',#thumb').show();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜