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

177
Views
SVG: Get clicked element

How to get the specific element inside SVG on which click was made?

    this.svgEl = document.createElementNS('http://www.w3.org/2000/svg', 'svg');        
    var s = Snap(this.svgEl);        
    var svgFromApi = (new DOMParser()).parseFromString("svg image from API", "image/svg+xml");
    s.clear();
    s.append(svgFromApi.documentElement);
    this.divElementRef.nativeElement.appendChild(this.svgEl); 

    this.svgElement.onclick = ()=> {               
           //Need to get on which element inside SVG it was clicked.   
       }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try this

this.svgEl.onclick = (event) => {               
   // event.target should contain the element that was clicked on
}
over 4 years ago · Santiago Trujillo Report
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!