I've few .children element within a .parent div. I would like to loop the children elements.
//This is working good.
$('.parent .children').each(function(){
//working good.
});
//But I would like to do that in the following way-
var parent = $('.parent');
$(parent + ' .children').each(function(){
});
This time I'm getting the following error-
jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [object Object] .children
Any help?
parent.find('.children').each()?$('.children', parent)pass parent element as context which us equivalent to ^^^^$(parent.selector + ' .children').each(function(){});