Jquery how to shuffle the array value? when toggleClass?
<p>I have 5 <code>li</code> elements, while I click on each of them, I am adding a class name <code>on</code> and push it into an array. I would like to remove the item from the object when a user is clicking again.</p>

<pre><code>&lt;ul&gt;
  &lt;li class="on" data-index="3"&gt;add 3&lt;/li&gt;
  &lt;li data-index="4"&gt;add 4&lt;/li&gt;
  &lt;li data-index="5"&gt;add 5&lt;/li&gt;
  &lt;li class="on" data-index="6"&gt;add 6&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>When a user clicks on a <code>li</code> I add a class called <code>on</code> and push the value into an array and sort the array after I pushed the item.</p>

<p>If a user clicks again on the <code>li</code> I can't remove the value from the array, because of the sort. Is there a way I can achieve this?</p>

<p>I don't have any idea to do the functionality regarding this.. any one can help me? I tried with splice, but no result.</p>
