JSFiddle - React, Tailwind, and code Playground

by rohanbhangui

JavaScript

$(document).ready(function () {

    var value_all_students = 0;

    function allstudents(value_all_students) {
        $("#select_grade_limit_both input").each(function (index) {
            var i = parseInt($(this).val());
            if (!isNaN(i)) {
                value_all_students += i;
            }
        });
        console.log('function all students:' + value_all_students);

    }


    function checkdts() {
        var arr = ["1", "2", "3", "4", "5", "6", "7"];
        allstudents(value_all_students);
        ///Check Grades
        $.each(arr, function (i, val) {
            //var y = $('select[name="select_grade_set_1"]').val();
            var x = $('select#select_grade_set_' + val).val();
            //alert(this);
            //alert(val);
            //alert(x);
            if (x == 'Pre-K' || x == 'K' || x == '1st') {
                if (value_all_students <= 120) {
                    $('#gp_set_1').css('display', 'block');
                    $('#gp_set_4').css('display', 'block');
                    //alert('pk-1');
                } else if (value_all_students >= 120) {
                    //alert(value_all_students);
                    $('#gp_set_1').css('display', 'none');
                    $('#gp_set_4').css('display', 'none');
                    if ($('#no_programs_2 p').length > 0) {} else {
                        $('#no_programs_2').append('<p><strong></strong></p>');
                    }
                }
            }
            //console.log(value_all_students + ' pk1');
        });
        ///Check Grades
        ///Check Grades
        $.each(arr, function (i, val) {
            //var y = $('select[name="select_grade_set_1"]').val();
            var x = $('select#select_grade_set_' + val).val();
            //alert(this);
            //alert(val);
            //alert(x);
            if (x == '2nd' || x == '3rd' || x == '4th' || x == '5th') {
                if (value_all_students <= 120) {
                   ...