Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok I think the question is too vague to be answered completely if you think about.</p> <blockquote> <p>Where are the contents of the new columns, and rows, coming from? What structure do you have? What've you tried already? What didn't work? <sup><a href="https://stackoverflow.com/users/82548/david-thomas">David Thomas</a> comment.</sup></p> </blockquote> <p>If you don't want to use a jQuery plugin like <a href="http://www.jankoatwarpspeed.com/examples/expandable-rows/" rel="nofollow noreferrer">this one</a> it means you will have to do it yourself and a) nobody here will do it for you completely b) much less without any information, that would just be guessing.</p> <p>That said here is a quick and dirty example of what your approach should be like.</p> <p>HTML</p> <pre><code>&lt;table border="1"&gt; &lt;tr class="clickable"&gt; &lt;td colspan="2"&gt;Click to toggle Next&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Test&lt;/td&gt; &lt;td&gt;Test 2&lt;/td&gt; &lt;/tr&gt; &lt;tr class="clickable"&gt; &lt;td colspan="2"&gt;Click to toggle Next&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Test&lt;/td&gt; &lt;td&gt;Test 2&lt;/td&gt; &lt;/tr&gt; &lt;tr class="clickable"&gt; &lt;td colspan="2"&gt;Click to toggle Next&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Test&lt;/td&gt; &lt;td&gt;Test 2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>jQuery</p> <pre><code>$(".clickable").click(function() { $(this).next().toggle(); }); </code></pre> <p>As I said it's <strong>just an example</strong>, it's not scalable (doesn't even support hiding two rows) you can see a <a href="http://jsfiddle.net/Trufa/hr2HA/3/" rel="nofollow noreferrer">demo here</a>.</p> <p>I can update the answer with a better more personalized answer if you update your question.</p> <p>But if you want to build it yourself, this are some of this could come in handy:</p> <p><a href="http://api.jquery.com/show/" rel="nofollow noreferrer">.show()</a><br /> <a href="http://api.jquery.com/hide/" rel="nofollow noreferrer">.hide()</a><br /> <a href="http://api.jquery.com/toggle/" rel="nofollow noreferrer">.toggle()</a><br /> <a href="http://api.jquery.com/animate/" rel="nofollow noreferrer">.animate()</a><br /> <a href="http://api.jquery.com/nth-child-selector/" rel="nofollow noreferrer">:nth-child</a><br /> <a href="http://api.jquery.com/children/" rel="nofollow noreferrer">.children()</a></p> <p>And many other depending on your approach.</p> <p>Good luck!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload