How can I handle events with dynamic ID in javascript?
<p>I have used dynamic id for the elements of the table. I would like to handle it in javascript. How can I do this? </p>

<pre><code>&lt;table&gt;
    &lt;%@task.each do |task|%&gt;
        &lt;tr id="task-&lt;%=task.id%&gt;"&gt;
            ....
        &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>Now in Javascript, how to get the id of the particular row to handle events like <code>onclick()</code> or <code>onchange()</code>?</p>