jQuery sparklines iterate over div
Posted
by
ßee
on Stack Overflow
See other posts from Stack Overflow
or by ßee
Published on 2012-06-22T21:05:48Z
Indexed on
2012/06/22
21:16 UTC
Read the original article
Hit count: 133
I have an array of divs and I want to iterate over each div and pass it to sparklines. like so:
var divs = $("#wrapper>div");
var data = ["1:2:3:4", "4:3:2:3:1"];
var i;
for(i = 0; i<data.length; i++){
divs[i].sparkline(data[i]);
}
I get the error "divs[i].sparkline" is not a function. But if I do this
divs.sparkline([1,2,3,4]);
its fine all the divs get the linegraph but with the same data.
Does anyone have any suggestions but how to use sparkline when iterating over divs?
Thanks!
© Stack Overflow or respective owner