Posted By

thecrumb on 01/23/08


Tagged

jquery


Versions (?)



Who likes this?

2 people have marked this snippet as a favorite

martingoldszein
korzhik


jquery - nextUntil


Published in: JavaScript 



Website Promotion
DIRECTORY
is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Then, your code should look like this ...

$(document).ready(function() { $("dt > a").click(function(){ $(this).parent().nextUntil('dt').toggle(); return false; }); });

Expand | Embed | Plain Text
  1. /******** next until > ****************/
  2. $.fn.nextUntil = function(expr) {
  3. var match = [];
  4.  
  5. // We need to figure out which elements to push onto the array
  6. this.each(function(){
  7. // Traverse through the sibling nodes
  8. for( var i = this.nextSibling; i; i = i.nextSibling ) {
  9. // Make sure that we're only dealing with elements
  10. if ( i.nodeType != 1 ) continue;
  11.  
  12. // If we find a match then we need to stop
  13. if ( jQuery.filter( expr, [i] ).r.length ) break;
  14.  
  15. // Otherwise, add it on to the stack
  16. match.push( i );
  17. }
  18. });
  19.  
  20. return this.pushStack( match, arguments );
  21. };
  22.  
  23. /******** < next until ****************/

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: Wholesale on March 10, 2010

Abercrombie And Fitch Abercrombie And Fitch Abercrombie AbercrombieAbercrombie Clothing Abercrombie Clothing Abercrombie UK Abercrombie UK Abercrombie London Abercrombie London Abercrombie Fitch Abercrombie Fitch Abercrombie Outlet Abercrombie Outlet Abercrombie Jeans Abercrombie Jeans Abercrombie Pants Abercrombie Pants Abercrombie Tees Abercrombie Tees Abercrombie Shorts Abercrombie Shorts Abercrombie Sweater Abercrombie Sweater Abercrombie Outerwear Abercrombie Outerwear Abercrombie Hoodies Abercrombie Hoodies Abercrombie Polo Abercrombie Polo Abercrombie ShirtsAbercrombie Shirts abercrombie henleys crew abercrombie henleys crew hollister hollister hollister uk hollister uk abercrombie mens abercrombie mens abercrombie womens abercrombie womens Ruehl 925 Ruehl 925 ed hardy ed hardy tiffany tiffany Abercrombie And Fitch Abercrombie And Fitch

You need to login to post a comment.