1

I try to trigger an event on mouse click but my event never start. First I I didn't select the good area but the mouse event "mousemove" trigger my event. I don't understand how it is possible... Does someone has an explaination or a solution to this problem?

d3.select("#chart").on("mousemove", function(){console.log("this");});
d3.select("#chart").on("click", function(){console.log("that");});

I can see "this" but not "that".

I've found this question but that doesn't solve my problem...

Community
  • 1
  • 1
Pierre GUILLAUME
  • 450
  • 3
  • 24

3 Answers3

0

You have mistaken the spelling of click, change

d3.select("#chart").on("clic", function(){console.log("that");});

to

d3.select("#chart").on("click", function(){console.log("that");});
Bhushan Kawadkar
  • 28,279
  • 5
  • 35
  • 57
0

You must use event 'click' ... not 'clic'

TonyB
  • 423
  • 4
  • 10
0

Show bigger part of your code. I`ve tried here to bind click event and everything works fine: D3.js test click

d3.select('#one').on('click', function(){console.log('Clicked!')})
vgoreiko
  • 45
  • 4