How to add and remove a LI from UL with jQuery?
<p>How do i use jQuery to add and remove item from unordered lists?
When i doubleclick on an item in list 1 it should be removed from list 1 and added to list 2
And of course, the other way around as well...</p>

<p>I've got the following lists:</p>

<pre><code>&lt;ul id='attached'&gt;
  &lt;li id='itemID_1' ondblclick='removeAttached(&amp;#39;itemID_1&amp;#39;)'&gt;Item&lt;/li&gt;
  &lt;li id='itemID_2' ondblclick='removeAttached(&amp;#39;itemID_2&amp;#39;)'&gt;Item&lt;/li&gt;
  &lt;li id='itemID_3' ondblclick='removeAttached(&amp;#39;itemID_3&amp;#39;)'&gt;Item&lt;/li&gt;
  &lt;li id='itemID_4' ondblclick='removeAttached(&amp;#39;itemID_4&amp;#39;)'&gt;Item&lt;/li&gt;
&lt;/ul&gt;

&lt;ul id='non-attached'&gt;
  &lt;li id='itemID_5' ondblclick='addAttached(&amp;#39;itemID_5&amp;#39;)'&gt;Item&lt;/li&gt;
  &lt;li id='itemID_6' ondblclick='addAttached(&amp;#39;itemID_6&amp;#39;)'&gt;Item&lt;/li&gt;
  &lt;li id='itemID_7' ondblclick='addAttached(&amp;#39;itemID_7&amp;#39;)'&gt;Item&lt;/li&gt;
  &lt;li id='itemID_8' ondblclick='addAttached(&amp;#39;itemID_8&amp;#39;)'&gt;Item&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>I was thinking something like:</p>

<pre><code>&lt;script type='text/javascript'&gt;")
  function addAttached(i) { $('#non-attached').remove(i); $('#attached').append(i); };")
  function removeAttached(i) { $('#attached').remove(i); $('#non-attached').append(i); };")
&lt;/script&gt;")
</code></pre>

<p>But i might be pretty off here?</p>
