Hi,

I think the following modification to your code will solve your purpose.

$(document).ready(function(){
                               $("a").click(function(event){
                                       //Loop through each productGroup div
                                       $(".productGroup").each(function(i){

                                               //Then for each div I'd like
to loop through the uniqueIDs.
                                               *$(this).find('div').*
each(function(i){

 alert($(this).html());
                                               });

                                       });
                                       event.preventDefault();
                               });
                       });

Thanks & Regards,
Dhruva Sagar.




On Sat, Dec 5, 2009 at 3:33 AM, TehNrd <jason.vena...@gmail.com> wrote:

> I am pretty new to jQuery and I've dug through the documentation for a
> few hours and I haven't found the answer. I'm curious if you can limit
> a selector to only search within a defined div or other html tag.
> Below is the code with some notes so it should be pretty easy to
> understand but if not let me know and I can clarify.
>
> <html>
>        <head>
>                <script type="text/javascript" src="
> http://ajax.googleapis.com/ajax/
> libs/jquery/1.3.2/jquery.min.js"></script>
>                <script type="text/javascript">
>                        $(document).ready(function(){
>                                $("a").click(function(event){
>                                        //Loop through each productGroup div
>                                        $(".productGroup").each(function(i){
>
>                                                //Then for each div I'd like
> to loop through the uniqueIDs.
>                                                $("select only the uniqueID
> in this productGroup div").each
> (function(i){
>
>  alert($(this).html());
>                                                });
>
>                                        });
>                                        event.preventDefault();
>                                });
>                        });
>                </script>
>        </head>
>
>        <body>
>                <a href="#">Go!</a>
>
>                <div class="productGroup">
>                        <div class="products">
>                                <span class="uniqueID">1</span>
>                                <span class="uniqueID">2</span>
>                                <span class="uniqueID">3</span>
>                        </div>
>                </div>
>
>                <div class="productGroup">
>                        <div class="products">
>                                <span class="uniqueID">4</span>
>                                <span class="uniqueID">5</span>
>                                <span class="uniqueID">6</span>
>                        </div>
>                </div>
>        </body>
> </html>
>
>
> Thanks for the help,
> Jason
>

Reply via email to