【发布时间】:2013-11-19 21:55:55
【问题描述】:
我正在尝试找出一种基于<input class="required"> 循环遍历以下必填字段的方法。目前我只评估循环中的第一个输入。我如何在这里使用循环来横穿 dom 并检查所有输入框?谢谢你。我见过类似的例子,在我的具体情况下,我似乎无法让它们工作。
$("#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 were rich
testFVforMillionaire(futureValue);
}
});
【问题讨论】:
标签: javascript jquery css loops