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();
精彩评论