title: Selecting a random li element - JQuery
body: <p>I was wondering if there is a way to have JQuery randomly select a <code>li</code> inside a <code>ul</code> tag. </p>
  
  <p>Example:</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li&gt;1&lt;/li&gt;
    &lt;li&gt;2&lt;/li&gt;
    &lt;li&gt;3&lt;/li&gt;
    &lt;li&gt;4&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>So here is what would happen, lets have a click event so, <code>$("ul li:last").trigger('click');</code>  but notice how it has <code>:last</code>, how could I specify whether it selects the second, third, or even the fourth <code>li</code> based in the tree randomly.</p>
  
  <p>UPDATE:</p>
  
  <p>I notice other suggested using math, what if I have a <code>ul li</code> list that is populated by MySQL, I wouldn't know how many <code>li</code> there would be.</p>