title: Why doesn't this simple jQuery toggle animation work properly?
body: <p>Your help would be very very much appreciated. I spend 4 hours trying to figuring this out, but was not successful, albeit it is a very easy example:</p>
  
  <p>Given the following (full running and Copy and Paste ready) example, I have two Strange Problems (occurring both on IE and Firefox):</p>
  
  <p>1.) When having the line <code>&lt;div id="notexid" style="clear:both;"&gt;</code> with the following style tag:  <code>"style="clear:both;"</code>, the problem is, that the Toggle Display does not "hide/slide in the layer. Whenever you click the link, the Layer only slides out (but that is of course not intended. It should slide in on the first click and slide out on the next click....) => So the <code>style="clear:both;"</code> breaks the jQuery toggle Function, but why??</p>
  
  <p>2.) If I remove the <code>style="clear:both;"</code> (which seem to cause this problem) then I get another strange behaviour that the Element to Toggle is displayed (=the rendering of the slide) not in its correct position but rather on the right hand side and jumps then after rendering to the final position. But why is this rendering done on the righthand side, when it later jumps back to the correct position??? (So jQuery knows where the correct position actually is....)</p>
  
  <p>I would really be grateful if someone can just confirm this is a strange bug in jQuery so I can submit this as bug. Or if someone has a solution to the problem this would be even more great!</p>
  
  <p>Thank you very much!!</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC"-// W3C//DTD HTML 4.01 Transitional//EN"" http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
  *.item {clear:both;}
  *.item &gt; *.label { display:block; float:left; width:150px; }
  *.item &gt; *.content { display:block; float:left; width:220px;}
    &lt;/style&gt;
  
  &lt;script type="text/javascript" language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  
  &lt;body&gt;
    &lt;form method="GET" accept-charset="UTF-8" action="dddd"&gt;
  
      &lt;div class="item"&gt;
        &lt;span class="label"&gt;
          &lt;label for="note"&gt;Label 0
          &lt;/label&gt;
        &lt;/span&gt;
        &lt;span class="content"&gt;
          &lt;textarea id="coafasf" name="casfasfasf" cols="30" rows="4"&gt;
          &lt;/textarea&gt;
        &lt;/span&gt;
      &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
          function toggleElement() {
            $("#notexid").slideToggle("slow");
          }
  
          $(document).ready ( function() {
  
            $("#notexid").before('&lt;div class="item"&gt;&lt;span class="label"&gt;&amp;nbsp;&lt;\/span&gt;&lt;span class="content"&gt;&lt;a href="javascript:toggleElement();"&gt; CLICK HERE TO TOGGLE  &lt;\/a&gt;&lt;\/span&gt;&lt;\/div&gt;');
  
          }
          );
  
        &lt;/script&gt; 
  
  
      &lt;!-- INSERT style="clear:both;" Solves the formating Problem but results in a broken toggle --&gt;
  
      &lt;div id="notexid" style="clear:both;"&gt;
        &lt;div class="item"&gt;
          &lt;span class="label"&gt;
            &lt;label for="note"&gt;Label 1
            &lt;/label&gt;
          &lt;/span&gt;
          &lt;span class="content"&gt;
            &lt;textarea id="test" name="test" cols="30" rows="2"&gt;
            &lt;/textarea&gt;
          &lt;/span&gt;
        &lt;/div&gt;
  
      &lt;/div&gt;      
  
      &lt;div class="item"&gt;
        &lt;span class="label"&gt;
          &lt;label for="teasst"&gt;Label 2
          &lt;/label&gt;
        &lt;/span&gt;
        &lt;span class="content"&gt;
          &lt;input id="aaaaaa" name="asdfasfasf" type="text"&gt;
        &lt;/span&gt;
  
      &lt;/div&gt;
  
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>