jQuery click() on a nested div
问题 The code can probably explain this better than I can: <div class="wrapper"> <div class="inner1"></div> <div class="inner2"></div> </div> <script> $('div').click(function(){ var class_name = $(this).attr('class'); do_something(class_name); }); </script> When I click on the inner1 div, it runs the do_something() with both the inner1 div AND the wrapper . With the site being built, nested divs are going to happen a lot. Is there a dynamic way to fix this issue and only run the top level div (in