How to prevent click event triggering for last li?
<pre><code>&lt;ul&gt;
&lt;li&gt;test&lt;/li&gt;
&lt;li&gt;test&lt;/li&gt;
&lt;li&gt;test&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>I need to prevent click event for last li element. I tried like below,</p>

<pre><code>$(document).on("click", "ul li:not(last-child)", function (e) {
//do something
}
</code></pre>

<p>But this is not working. Post your answers if came across the same. </p>

<p>Thanks in advance !!!</p>