I have a bunch of divs of classname foo within a div of classname fooContainer (these foo divs have been dynamically added to fooContainer).
I have a function operateOnFoo(fooObjectToBeOperatedOn) that operates on a single foo div (that is passed into operateOnFoo as a parameter).
I would like to use the jQuery each() feature to run the operateOnFoo function on all/each of the divs of classname foo within fooContainer. I have tried using calls like:
operateOnFoo( $("#fooContainter").each( ".foo" ) );
and
$("#fooContainter").each( operateOnFoo( foo ) );
and
$("#fooContainer").find(".foo").each( operateOnFoo( ".foo" ) );
but I just can't get it to work. How do I proceed?
I'm a little new to web developing, teaching myself as I go along, so I apologize if this question is overly basic - but I couldn't seem to get it working using other similar Stack Exchange posts as I have been able to do with most of my other issues.
Thanks!
$("#fooContainer .foo").each( operateOnFoo );operateOnFoowants the element as the first argument which isn't how.each()calls its callback.eachis broken.