jQuery Run code for every element found

Viewed 6562

I have a list and am using jQuery to get every LI in the list:

$('ul li')

How do i get it so that I run code after each element is found, but not an event; like this:

$('ul li').code(function() {
    alert('this will alert for every li found.');
});

Whats the best way for me to do this?

2 Answers
Related