This is the jQuery problem that I am facing, and I always have to solve using methods that I am not proud of.
I am trying to keep a collection of items for later evaluation. The problem is that every time I try to access and apply a function to it, the error console reports that it is not a function. I am convinced that I have a misunderstanding of how jQuery works. However, I would like to be pointed in the right direction. Here is the code I'm using:
var products = $('ul.products');
var productLists = []
$.each(products, function (i) {
productLists[i] = products[i].children('li');
console.log(productLists[i]);
});
and here is the error I get:
Uncaught TypeError: Property 'children' of object
source
share