javascript - Word cloud unable to use onClick -
i'm building wordcloud using jason davies d3.layout.cloud() https://github.com/jasondavies/d3-cloud.git decided add transition , duration attributes make wordcloud better when arrives on screen . however, can't use on("click") attribute anymore since sends me error : uncaught typeerror: undefined not function refers line .on("click", function (d) {alert('ok');}) when remove transition , duration, on click works correctly . here js code : var fill = d3.scale.category20(); var layout = d3.layout.cloud().size([1500, 800]) .words(frequency_list) .padding(5) .rotate(function() {return ~~(math.random() -0.5) * 120;}) .font("impact") .fontsize(function(d) { return d.size; }) .on("end", draw); layout.start(); function draw(words) { d3.select("svg").remove(); d3.select("body").append("svg") .attr("width", layout.size()[0]) .attr(...