How to hide certain elements on a page using jQuery

Posted by Ankur on Stack Overflow See other posts from Stack Overflow or by Ankur
Published on 2010-04-10T08:43:36Z Indexed on 2010/04/10 8:53 UTC
Read the original article Hit count: 271

Filed under:
|
|
|

I am trying to implement something that is similar to a faceted search. My data is a series of objects and relationships. The idea is that you click an object (in this case "95 Theses" and then the possibly relationships are displayed, in this case "author" and clicking the relationship shows the object that matches the relationship, in this case "Martin Luther".

My clicking of objects and relationsips (predicates) works fine. What I need to do is allow users to click an object or relationship and have all those that extend from it removed.

This is what I thought of adding when a object or relationship 'tag' is clicked (every time I add another object or relationship I increment the global attribute called 'level'):

if($(".objHolder,. preHolder").filter("[level>'"+level+"']").filter("[holderId='"+holderId+"']").length) 
{    $(".objHolder,. preHolder").filter("[level>'"+level+"']").filter("[holderId='"+holderId+"']").remove();   }

<table border="0" cellpadding="4" cellspacing="2">
 <tbody><tr>
   <td class="objHolder" objid="1" holderid="1" level="1">
    <table border="0" cellpadding="4" cellspacing="2">
    <tbody><tr class="objItemRow" objid="1" holderid="1" level="1">
           <td class="objItem" objid="1" holderid="1" level="2" bgcolor="#eeeeee" nowrap="nowrap">95 Theses</td>
        </tr></tbody>
            </table></td>
         <td><img src="images/right.jpg" alt="" height="10" width="16"></td>
         <td class="preHolder" level="2" holderid="1">
        <table border="0" cellpadding="4" cellspacing="2"><tbody>
         <tr><td class="preItem" level="3" subid="1" preid="1" holderid="1" bgcolor="#eeeeee" nowrap="nowrap">author</td></tr>
        </tbody></table></td>
        <td><img src="images/right.jpg" alt="" height="10" width="16"></td>
        <td class="objHolder" level="3" holderid="1">
         <table border="0" cellpadding="4" cellspacing="2"><tbody><tr><td class="objItem" level="4" objid="3" holderid="1" bgcolor="#eeeeee" nowrap="nowrap">Martin Luther</td></tr></tbody></table>
        </td>
    </tr></tbody>
    </table>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about remove