studiobl wrote: > I'm working on a wireframe for an ecommerce site. I need to simulate > some shopping cart functionality, like updating total counts and > dollar amounts on change(). I've already done this with a page that > contains one table. This page contains multiple tables, so I need to > add another loop: > > from > > <-- > > $(".someGrid input").each(function(){ > //some kind of code... > }); > > --> > > to > > <-- > > $(".someGrid").each(function(){ > $(this + " input").each(function(){ > //some kind of code > }); > }); > > --> > > The problem is, the second one isn't working. How can I loop through > the tables, then loop through the inputs they contain?
You can do $("input", this) to find all the inputs (the optional second parameter is the context to run the selector on (i.e. must be a child in it)). -Sam