Swap div content from the same text link
<p>I am having trouble resolving an issue using traditional JavaScript and was wondering if there is an easy solution using jQuery. I've searched the web and haven't been able to find anything that does exactly what i want to do.</p>

<p>So.. this is what i want to achieve:<br>
I have 2 div's with content, first one is displayed, second is hidden. 
Below and outside of these div's i have a single text link which when first clicked, will swap the content on the first div with the second div. When clicked a second time i want it to  swap back to first div and so on.. It should toggle between the 2 div's on each onClick every time i click the text link.</p>

<p>To put a bit more context to it, my div's contain a form with 2 labels and text inputs. In the first div the labels say To: and From: In the second div, the order is simply flipped to say From: and then To: <br>Below the inputs i have a text link that will allow the user to switch the order around to From: and To:</p>

<p><strong>To:</strong><br>
text input<br>
<strong>From:</strong><br>
text input<br>
- Text link -</p>

<p>When the text link is clicked i want the content replaced with this:</p>

<p><strong>From:</strong><br>
text input<br>
<strong>To:</strong><br>
text input<br><br></p>

<p><strong>Here is an example of what i've tried</strong> - <em>Note: This is very close to how i want it except when the link is clicked a second time, nothing happens</em><br></p>

<pre><code>&lt;script type="text/javascript"&gt;

&lt;code&gt;function hideID(objID){
var element = document.getElementById(objID);
element.style.display="none";
}
function showID(objID){
var element = document.getElementById(objID);
element.style.display="block";
}&lt;/code&gt;

&lt;/script&gt;
</code></pre>

<p><br></p>

<pre><code>&lt;div id="div1"&gt;content 1&lt;/div&gt;
</code></pre>

<p><br></p>

<pre><code>&lt;div id="div2" style="display:none;"&gt;content 2&lt;/div&gt;
</code></pre>

<p><br></p>

<pre><code>&lt;a href="" onClick="hideID('div1');showID('div2'); return false;"&gt;Reverse&lt;/a&gt;
</code></pre>

<p>If anyone has any ideas, i would be very greatful<br>
kind regards<br>
~declan</p>
