JSFiddle - React, Tailwind, and code Playground
by Nick Hulea
JavaScript
var arr = ["1", "2", "3", "4", "5", "6", "7"];
$('select').each(arr, function (i, val) {
var y = $('select[name="select_grade_set_1"]').val();
var x = $('select#select_grade_set_' + val).val();
//var x = $('select[name="select_grade_set_' + this + '"]').val();
//var s = sum($('input#number_students_set_' + (this + 1)).val());
//alert(y);
alert(this);
alert(val);
alert(x);
if (x == 'Pre-K' || x == 'K' || x == '1st') {
$('#gp_set_1').show();
alert('pk-1');
} else if (x == '2nd' || x == '3rd' || x == '4th' || x == '5th') {
$('#gp_set_2').show();
alert('2-5');
} else if (x == '6th' || x == '7th' || x == '8th' || x == '9th' || x == '10th' || x == '11th' || x == '12th') {
$('#gp_set_3').show();
alert('6-12');
} else {
}
//if (s >= 120) {
//$('#gp_set_1').hide();
// $('#gp_set_2').hide();
// $('#gp_set_3').hide();
//} else {
// }
});