Is there a way to loop through required fields marked with <input class="required">
? Currently, only the first input in the loop is being evaluated. How can I traverse the DOM using a loop to check all input boxes? Thank you for your help. While I have seen similar examples, I am struggling to make them work in my specific case.
$("#howMuch").click(function () {
var numOfPeriods = 0;
//Validates for empty code only.
if ($('.required').val().length == 0) {
$('.modal').show();
$('.modal_content').text('Please fill in the Required Fields');
} else {
//Clear previous graph
clearGraph();
//Adjust the number of periods from years to month
numOfPeriods = yearToMonthAdj();
//Declare a variable for the final future value
var futureValue = createiRateGraphNoInterest(numOfPeriods);
//Test if we're rich
testFVforMillionaire(futureValue);
}
});