Reputation: 1549
I was trying to get the immediate children divs of a div with id to-append.
I found this works:
console.log($("#to-append > div").length);
But since I am using that div quite a lot, it is stored in a variable:
var $toappend = $('#to-append');
How would I go about getting the divs length using the variable?
console.log($($toappend+" > div").length);
Throws an error
Thank you
Upvotes: 0
Views: 102