<p>I have two elements:</p>

<pre><code>&lt;input a&gt;
&lt;input b onclick="..."&gt;
</code></pre>

<p>When b is clicked, I want to access a and manipulate some of its data. A does not have a globally unique name, so <code>document.getElementsByName</code> is out. Looking into the event object, I thought <code>event.target.parentNode</code> would have some function like <code>getElementsByName</code>, but this does not seem to be the case with &lt;td&gt;s. Is there any simple way to do this?</p>

If
```
a
```
and
```
b
```
are next to each other and have the same parent, you can use the
```
prevSibling
```
property of
```
b
```
to find
```
a
```
.