Javascript onclick even on a div not working <p>I have a div and when a user clicks on it using the <code>onclick</code> event, i'm calling a function:</p> <pre><code> function test(a) { alert(a); } &lt;div onclick="javascript:test('zaswde');"&gt;sdfasdasdadasdasds&lt;/div&gt;​ </code></pre> <p><strong>Update</strong></p> <pre><code> &lt;ul&gt; &lt;li&gt; &lt;div&gt; &lt;div onclick="javascript:alert('v'); "&gt;&lt;/div&gt; &lt;/div&gt; &lt;div &gt;&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Can't i use <code>onclick</code> on the div element? ​</p>