Using the jQuery each() function to loop through classname elements

I am trying to use jQuery to loop through a list of elements that have the same classname & extract their values.

I have this..

  • jQuery loop through Child divs
  • Creating a variable, with a variable in an each loop - jQuery
  • Using .each on dynamic objects in jQuery?
  • jQuery: Finding duplicate ID's and removing all but the first
  • JQuery and Underscore “each” guarantee order for an array?
  • Remove an item from an array by value
  • function calculate() {
        // Fix jQuery conflicts
            // Get all items with the calculate className
            var items = jQuery('.calculate');

    I was reading up on the each() function though got confused how to use it properly in this instance.

  • Delete this from a javascript object in a jQuery .each()
  • Jquery .each through Divs inside another Div
  • jQuery.each implementation differs from native Array.forEach
  • JQuery $.each returning same data set twice
  • Why is my jQuery each loop not adding values correctly?
  • Using jQuery to get data attribute values with .each()
  • One Solution collect form web for “Using the jQuery each() function to loop through classname elements”

    jQuery('.calculate').each(function() {
        var currentElement = $(this);
        var value = currentElement.val(); // if it is an input/select/textarea field
        // TODO: do something with the value

    and if you wanted to get its index in the collection:

    jQuery('.calculate').each(function(index, currentElement) {

    Reference: .each() and .val() functions.