I have a line of code that uses mootools to get an array of elements with the given selectors
var menuItems = $$('#container .menu');
I need to convert this to jquery but can't find a solution. I have tried jQuery('#container .menu') but it doesn't return an array.
Is there a way to use '.find()' from jquery on the whole document ? (since I don't have a parent element to make it like parent.find()..)
Any other suggestion is also most welcome
With jQuery your statement:
will return a jQuery object that contains all matching elements where you can access the individual DOM elements with array-like syntax:
If you want an actual array rather than an array-like object you can use jQuery's
.toArray()
method:Why don't you try one of the jQuery tutorials available at the jQuery website?