# Add \`onclick\` attribute directly to Perspective button

**URL:** <https://forum.inductiveautomation.com/t/add-onclick-attribute-directly-to-perspective-button/41623>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 17, 2020, 6:57pm UTC](https://forum.inductiveautomation.com/t/add-onclick-attribute-directly-to-perspective-button/41623 "2020-12-17T18:57:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [December 17, 2020, 6:57pm UTC](https://forum.inductiveautomation.com/t/add-onclick-attribute-directly-to-perspective-button/41623/1 "2020-12-17T18:57:20Z")

</div>

I’m using the WebDev and Perspective modules to create a custom page. In this page, I have a `Print` button, which I want to trigger a function inside my `index.html` text resource script.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/6/7626826c05d401ef64734b089d4548c223dc0ebb.png)  
Is it possible to bypass Perspective’s event handlers and add an **`onclick`** attribute directly to the button? For example (this is _ **not** _ what I want to do), show an alert on button click with `alert('Hello, World!')`.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 17, 2020, 10:49pm UTC](https://forum.inductiveautomation.com/t/add-onclick-attribute-directly-to-perspective-button/41623/2 "2020-12-17T22:49:48Z")

</div>

It depends. If this button is being rendered by Perspective, then, no - the only way you can attach custom JS behavior is via a custom module that adds its own Perspective components.  
If the button is being rendered via webdev and hosted inside an iframe in a Perspective session, then, yes, you could attach your own code to it.
