1

i have this code

<table class="table">
    <tr>
         <th>Person</th>
        <th>Doc</th>
        <th>Active</th>
        <th></th>
    </tr>
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <tr class="lnk">
                <td><%# Eval("person") %></td>
                <td><%# Eval("doc") %></td>
                    <td> <asp:CheckBox ID="CheckBox1" Checked=' <%# Eval("active") %>' Enabled="false" runat="server" /></td>
                  <td>
                    <a href="show.aspx?id=<%# Eval("document") %>">Details</a> |
                    <a class="lnk-h" href="edit.aspx?id=<%# Eval("document") %>">Edit</a> |
                    <a class="lnk-h" href="destroy.aspx?id=<%# Eval("document") %>">Delete</a>
                </td>
                </tr>
            </ItemTemplate>
        </asp:Repeater>
</table>        

I need chek if person it is active or not, if it is inactive, i want hide links delete and edit

can any helpme please

i started with this code but isent work

 <script>
   $(document).ready(function () {
          $(".lnk").each(function () {
           if( $(this).children("input:checkbox").is(":checked"))
           {
               $(this).children(".lnk-h").css("display","none");
           }
       });
   })

Thanks in advance

3
  • I cannot see any DOMs with class "lnk" that it would loop?
    – NotJustin
    Jun 2, 2015 at 16:02
  • oh sorry, i added it Jun 2, 2015 at 16:09
  • i was making tests, sorry again, but it is only an idea and not work, im learning jquery but i cant solve this :( Jun 2, 2015 at 16:14

1 Answer 1

0

I think you cannot use children() as it is only checking children just under given DOM element.

DOM elements under lnk are all <td> which is why it will not find selectors "input:checkbox" and ".lnk-h".

You should use "find" that goes through all children:

if( $(this).find("input:checkbox").is(":checked"))
    {
        $(this).find(".lnk-h").css("display","none");
    }
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.