jQuery Tidbits : jQuery.each()

A lot of devs doing jQuery might have used the jQuery(selector).each() method in instances where you need to perform an action on all the elements returned by jQuery.  But did you know that the jQuery utilities provide you the same functionality for iterating through an array.

var array = [“Kevin”, “Bob”, “Joel”, “Keith”];

$.each(array, function (index, value) {
     alert(“Say hello to “ + value);

Check it out here!

comments powered by Disqus