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.
$('.calculate').each(function(index, element) {
$(this).text()
});