2016-02-12 80 views
2
d3.select('#le'+j.toString()).style("background-color", j==i?"#ffffaf":"#dfdfdf"); 
    //$('#le'+j.toString()).style("background-color", j==i?"#ffffaf":"#dfdfdf"); 

作品。D3.js如何选择jQuery不能使用的元素?

//d3.select('#le'+j.toString()).style("background-color", j==i?"#ffffaf":"#dfdfdf"); 
    $('#le'+j.toString()).style("background-color", j==i?"#ffffaf":"#dfdfdf"); 

不起作用。我得到以下错误:

enter image description here

+0

jQuery的没有一个'.style()'方法。改用'.css()'方法.. –

回答

5

它必须是

$('#le'+j.toString()).css("background-color", j==i?"#ffffaf":"#dfdfdf"); 

,而不是

$('#le'+j.toString()).style("background-color", j==i?"#ffffaf":"#dfdfdf");