# JAVASCRIPT onClick, which button was clicked?

**URL:** <https://forum.kirupa.com/t/javascript-onclick-which-button-was-clicked/289122>\
**Category:** web dev\
**Created:** [May 26, 2009, 5:02pm UTC](https://forum.kirupa.com/t/javascript-onclick-which-button-was-clicked/289122 "2009-05-26T17:02:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)\
**Post date:** [May 26, 2009, 5:02pm UTC](https://forum.kirupa.com/t/javascript-onclick-which-button-was-clicked/289122/1 "2009-05-26T17:02:13Z")

</div>

I have something like this:

```auto

<tr><td>Local</td><td id="localTime"></td><td><input type="button" value="Get Time" onClick="getServerTime()" /></td></tr>
<tr><td>New York</td><td id="newyorkTime"></td><td><input type="button" value="Get Time" onClick="getServerTime()" /></td></tr>
<tr><td>Tokyo</td><td id="tokyoTime"></td><td><input type="button" value="Get Time" onClick="getServerTime()" /></td></tr>

```

All of those buttons have an onClick=“getServerTime()”

But how do I find out WHICH BUTTON was clicked? Is there a variable? a method?  
All of the buttons call getServerTime, but I need to know which button was clicked.

Thanks in advance.

Leo  
:hair:
