Guest User

jquery parentsUntil bug

a guest
Oct 28th, 2011
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5. <head>
  6. <title>$.parentsUntil</title>
  7. <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
  8. <script>
  9. $(function() {
  10.     $('#awol').bind('click', function() {
  11.         $(this).parentsUntil('.foo').css('background-color','yellow');
  12.     });
  13. });
  14. </script>
  15. </head>
  16.  
  17. <body>
  18. <div class="foo" style="background-color: red; width: 100px; height: 100px; padding: 10px;">
  19.     <div class="dummy">
  20.         <div class="fooBar" style="background-color: green; width: 80px; height: 80px; padding: 10px;">
  21.             <div class="dummy">
  22.                 <div id="awol" style="background-color: blue; width: 60px; height: 60px; padding: 10px;"></div>
  23.             </div>
  24.         </div>
  25.     </div>
  26. </div>
  27. </body>
  28.  
  29. </html>
  30.  
  31.  
  32.  
RAW Paste Data