looping

JQuery 'each()' method

Just found this sort of holy grail of JQuery looping. As usual, I have little time to elaborate.... so here's what I did:

To show only a specified number of entries in a tag-set. The example here is on a set of divs with class="comment".

  $('#comments .comment').each
  (
    function (idx)
    {
      if(idx>1)
      {
        $(this).css("display", "none");
      }
    }
  );

This is how I used the each method. (In my usage) each() takes a function as a parameter.

Technologies:
Subscribe to RSS - looping