Mohammad
Mohammad

Reputation: 7418

jQuery selector not working as expected

I have this code:

alert (panes.selector); //gives me .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.

Upvotes: 1

Views: 115

Answers (1)

Headshota
Headshota

Reputation: 21449

maybe it's type conversion problem

Try:

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

Upvotes: 2

Related Questions