Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
onClick is working only on the second click, im using d3.js

I'm using .on('click') in my code but it is working only when I double click the element.

I'm wondering what's causing this issue.

Here's the code:

node = instance
                  .selectAll('.node')
                  .data(bubble(nodes).descendants())
                  .enter()
                  .filter(d => !d.children)
                  .append('g')
                  .attr('class', styles.widgetComponentCusterNode)
                  .attr('transform', () => `translate(${width / 2},${height / 2})`)
                  .on('click', d => {
                    
                    console.log('OnClick event called!!!');

                  })
                  .call(d3.drag().on('setContexttart', dragstarted).on('drag', dragged).on('end', dragended))
                  .on('mouseover', mouseover)
                  .on('mouseout', mouseout);

Am I missing something here?

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!