title: How to move or swap elements in jQuery?
body: <p>The goal is to move an element before its left sibling or after its right sibling.</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;One&lt;/li&gt;
      &lt;li&gt;Two&lt;/li&gt;
      &lt;li&gt;Three&lt;/li&gt;
      &lt;li&gt;One&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Given only the index of the element, I need to move it to left or right. Say the index is 1 (LI with "Two" as innerText), then I want to move it to left, the output should be:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;Two&lt;/li&gt;
      &lt;li&gt;One&lt;/li&gt;
      &lt;li&gt;Three&lt;/li&gt;
      &lt;li&gt;One&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>