jquery - Get all next siblings of element -
what best way next siblings of element? not next 1 , not siblings before it?
this way found, there jquery selector it?
$('.someclass').click(function () { var chosenone = $(this); $('.someclass').removeclass('extraclass'); chosenone.parent().find('.someclass').each(function () { var el = $(this).index(); if (el >= chosenone.index()) { $(this).addclass('extraclass'); } }); });
the .nextall() method made this:
chosenone.nextall(".someclass").addback().addclass("extraclass")
Comments
Post a Comment