jQuery to loop through elements with the same class
Use each: ‘i‘ is the postion in the array, obj is the DOM object that you are iterating (can be accessed through the jQuery wrapper $(this) as well). $(‘.testimonial’).each(function(i, obj) { //test }); Check the api reference for more information.