开发者

jQuery selector not working as expected

I have this code:

alert (panes.selector); //gives me 开发者_如何学JAVA.css-panes .pane

var size = $(panes.selector).size(); 
alert (size); //gives me 0, confused I run the selector itself

var size = $(".css-panes .pane").size();
alert (size); //gives me 1 which is what I expect

What am I doing wrong?

Thank you.

SOLVED. Accidental (typo) use of panes instead of pane in the actual html. Sorry to everyone who spent time figuring this out.


maybe it's type conversion problem

Try:

var size = $(panes.selector + "").size();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜