Already solved but I thought it would be fun to solve it by hand :D
jQuery.fn.getDDs = function(){
var next = $(this[this.length-1]).next();
if(next.is('dd')){
return this.add(next).getDDs();
} else { return this.not('dt'); };
};
this is a bit faster:
jQuery.fn.getDDs = func
@Paperboy:
Sorry, both solutions you pointed out selects ALL dd after the dt clicked. Tks!
@Karl:
The plugin you pointed out do the job. Tks!
MaurĂcio
I doubt that will work, since all of the elements are siblings of
the clicked .
Mauricio, Take a look at the nextUntil plugin. That should do what
you're looking for:
http://docs.jquery.com/JQuery_1.2_Roadmap#.nextUntil.28.29_.2F_.prevUntil.28.29
After including the plugin, you can do thi
You could use something like this:
$('dt:eq(0)').nextAll('dd').doSomething();
$('dt:eq(1)').nextAll('dd').doSomething();
$('dt:eq(2)').nextAll('dd').doSomething();
$('dt:eq(3)').nextAll('dd').doSomething();
$('dt:eq(4)').nextAll('dd').doSomething(); // and so on...
This should work for you:
$('dt').click(function() {
$(this).nextAll('dd').doSomething()
});
5 matches
Mail list logo