jquery displaying table rows dynamically in dom belonging to one/more particular class

Posted by whatf on Stack Overflow See other posts from Stack Overflow or by whatf
Published on 2012-11-24T22:19:02Z Indexed on 2012/11/24 23:04 UTC
Read the original article Hit count: 152

Filed under:
|
|

I have the basic html structure:

<table>

  <tbody>
    <tr class="1">
      <td>
        <p style="font-size:large"> 
            <span class="muted"> This is the first object </span> 
        </p>
      </td>
    </tr>

    <tr class="2">
      <td>
        <p style="font-size:large"> 
            <span class="muted"> This is second object </span> 
        </p>
      </td>
    </tr>

    <tr class="3">
        <p style="font-size:large"> 
            <span class="muted"> this is the third object </span> 
        </p>
      </td>
    </tr>

</tbody>
</table>

and then I have check boxes, the functionality i want is, if checkbox 1 is checked, only the tr with class 1 be displayed.

if checkbox 2 and 3 are clicked, the tr with class 1 gets hidden and 2, 3 show in the dom.

again if checkbox 2,*3* are unchecked and 1 is checked tr with class 2, 3 do not show and 1 is showed.

How can this be done in jQuery?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery