# Is there a way to get the ID of a SVG element onClick?

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-way-to-get-the-id-of-a-svg-element-onclick/89094>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 19, 2024, 5:25am UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-get-the-id-of-a-svg-element-onclick/89094 "2024-04-19T05:25:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vasanth.p](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vasanth.p/32/38099_2.png) [@vasanth.p](https://forum.inductiveautomation.com/u/vasanth.p)\
**Post date:** [April 19, 2024, 5:25am UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-get-the-id-of-a-svg-element-onclick/89094/1 "2024-04-19T05:25:28Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/d/6d351ad8e3bb8b0d038ff99ea2aa96bfe9df9b6f.png)  
I have a large SVG file with 100s of elements, I would like to do various activities based on user click on different components.

I am differentiating each element by a custom property named 'id'

But I am not sure how to access it to check which element is clicked.

In this above example,  
I created a custom property 'id' on elements[1]['elements'][0] and assigned it a value 'something', How to find the user clicked on element 'something' ?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [April 19, 2024, 6:41am UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-get-the-id-of-a-svg-element-onclick/89094/2 "2024-04-19T06:41:37Z")

</div>

Only if you inject some js, i think it only works with "name" though not with "id" (so you should do `name:"something"`

> [@New Feature: Perspective Piping](https://forum.inductiveautomation.com/t/new-feature-perspective-piping/49919/138):
>
> welp... i just had to try it out didnt it crazy_face Required version 8.1.22 Behold! JS INJECTED SVG CLICKER [jsInjectedSvgClicker.zip](https://forum.inductiveautomation.com/uploads/short-url/yDwMpbCRuyjgMnIYAO9s4YWkTIz.zip) (3.6 KB) edit: I made the value of the binding become the name it writes to in the view.custom props Be sure to set the custom prop back to null after handling your event so you can trigger the onchange events on the prop wink It should only detect things inside this view. Haven't fully tested it though.
