proper way to hide dynamic elements with jQuery

Posted by GrandVizier on Stack Overflow See other posts from Stack Overflow or by GrandVizier
Published on 2010-05-24T19:17:30Z Indexed on 2010/05/24 19:21 UTC
Read the original article Hit count: 201

Filed under:
|

I have a div element which my code will fill with a dynamic amount of links. Using jquery, I want to hide all the links except the first one. This is what I came up with and it works, I was just wondering if this is the best way to do it:

 
    $("#panelContainer").each(function(n) {
        $(this).children().hide();
        $("#panelContainer a:first").show();
    });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about hide