run a function when a user clicks on any list element
<p>This is probably a very common question, but I was unable to find an answer myself;</p>

<p>All my list elements call the function setQuery like this</p>

<pre><code>onClick="admin_stats.setQuery(this);"
</code></pre>

<p>rather than [hardcode] add this to every list element, is there a  way to simply have it run when a list element is clicked?</p>

<p>I'm not very familiar with jQuery Live or binding/unbinding, but I think they would play a role here?</p>

<p>Before I reinvent a rather square-looking wheel I thought I might ask =)</p>

<p><hr>
edit: my list elements look like</p>

<pre><code>&lt;ul&gt;
    &lt;li id="usersPerMonth" onClick="admin_stats.setQuery(this);"&gt;Users per Month&lt;/li&gt;
    &lt;li id="statsByUser" onClick="admin_stats.setQuery(this);"&gt;Stats by User&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>the this.attr("id") is then used to look up what the actually SQL text looks like, from a json-style variable:</p>

<pre><code>queries : {
    usersPerMonth : " ... some sql ...",
    statsByUser   : " ... some sql ...",
    ...
}
</code></pre>

<p>so that's why I have the divs named that way (and I'm open to design suggestions)</p>
