Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Why not just apply the same function to every checkbox ? If I understand correctly, you want to hide the parent row ?</p> <pre><code>$('input[type=checkbox]').click(function(){ $(this).parent('tr').toggle($(this).is(':checked')); }); </code></pre> <p>This code is not tested, but I hope it gives you an idea.</p> <p>Edit: Added the '$(this).is(':checked')' so it would only hide the row is the checkbox was checked.</p> <p>Editted after the code example: Ok I just looked at your code. Please explane me one thing because I can't figure it out. You build the whole table out of divs and spans. Why is that ? Why not just use a normal table ? (I know there are a tons of reasons for it but I wonder what yours is). But what really stunned me is the fact that at the bottom of your page, you do use a table to align 2 anchor tags next to eachother. Why not also use a div here ?</p> <p>Furthermore I would like to advise you to take a second look at your HTML. If you want to use jQuery a lot, it's easier to put the affected dom elements of 1 action in the same div. I'll post an example of this below. This is because it is easier to find this elements with the selectors.</p> <pre><code>Example: (wrong way) &lt;div&gt; &lt;input type="checkbox"&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="text"&gt; &lt;/div&gt; (right way, atleast for me) &lt;div&gt; &lt;input type="checkbox"&gt; &lt;input type="text"&gt; &lt;/div&gt; </code></pre> <p>I hope I have informed you enough. If you have any questions. Please feel free to ask ^^.</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