title: Expanding and collapsing table rows in jQuery
body: <p>Here is the <strong><code>jQuery code</code></strong> for <strong><code>expanding and collapsing the rows in a table</code></strong> but it just doesn't seem to work. Am I going wrong anywhere ?</p>
  
  <pre><code>$('.Complex').click(function() {
      if ($(this).hasClass("collapsed")) {
          $(this).nextUntil('tr.Complex')
              .find('td')
              .parent()
              .find('td &gt; div')
              .slideDown("fast", function() {
                  var $set = $(this);
                  $set.replaceWith($set.contents());
              });
          $(this).removeClass("collapsed");
      } else {
          $(this).nextUntil('tr.Complex')
              .find('td')
              .wrapInner('&lt;div style="display: block;" /&gt;')
          $(this).addClass("collapsed");
      }.parent()
          .find('td &gt; div')
          .slideUp("fast");
  });
  </code></pre>
  
  <p>The following is the <strong>jsFiddle</strong> </p>
  
  <p><a href="https://jsfiddle.net/uxc3fkcm/" rel="nofollow">https://jsfiddle.net/uxc3fkcm/</a></p>