Do looping through items and adding handlers to it hurt performance

Does it hurt in performance when I loop through list-items and add a clickhandler to all separate items?

The reason I do this is because I would only like to make the list item clickable if it contains an hyperlink.

The code I’m currenlty using is:

$  ('ul.paginator li').each(function() {
  if ($  ('a', this).length > 0) {
    $  (this).css('cursor', 'pointer');
    $  (this).click(function() {
      location.href = $  ('a', this).attr('href');
    });
  }
});

newest questions tagged jquery – Stack Overflow

About Admin