Use the associated div's context: $(".headerbutton img","#div_1");
This is also highly optimal as jQuery no longer searches the entire DOM for all classes of "headerbutton", only the nodes with class "headerbutton" in the context of "#div_1". You can read more about context here: http://docs.jquery.com/Core/jQuery#expressioncontext Cheers. Joe http://www.subprint.com On Dec 29, 9:51 am, Eric Martin <emarti...@gmail.com> wrote: > Depending on what you are trying to do: > > $("#div_1 .headerButton img"); // return the img in header button for > div_1 > > $(".headerButton img"); // return an array of img for > each .headerButton > You can then iterate over the array for additional processing. > > If you are passing the div_n (divId) dynamically, the following will > work: > $("#" + divId + " .headerButton img"); > > Hope that helps. > > -Eric > > On Dec 29, 7:19 am, daveyoi <dave_andr...@foobar.me.uk> wrote: > > > Sorry - left out the important part > > > The containing div (div_1) can be created more than one on a page -- > > so div_1 , div_2 , div_3 and they would all contain the structure > > described above.. this is why I cant just access using $ > > (".headerButton") as there could be potentially more than 1. > > > I reasoned therefore that i need to access via the unique div_n id > > and make way through the selectors to ensure i get the right one..?