jquery - D3 select sibling, give it a class -
i have several group elements, siblings.
i'm trying select 1 class of 'sliceactive' , give class of 'slice' , give next sibling down class of 'sliceactive'
all of on click event next button. know how select .activeslice , give .slice how select next g node , give .sliceactive?
$(".button").click(function(){ d3.select("g.sliceactive").attr('class','slice'); });
you can use css adjacent sibling
d3.select("g.sliceactive + g").attr('class','sliceactive');
might want check browser support based on particular requirements.
Comments
Post a Comment