HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/immoginis.komma.pro/wwwroot/js/formHome.js
/**
 * Created by Pascal on 07/04/16.
 */

var inputs = document.getElementsByClassName('type_checkbox');

var select = document.getElementById('select');
var deselect = document.getElementById('deselect');


    select.onclick = function () {
        Array.prototype.forEach.call(inputs, function (el) {
            el.checked = true;
            el.classList.add('active');
        });
        checkAmountActive();
    };

    deselect.onclick = function () {
        Array.prototype.forEach.call(inputs, function (el) {
            el.checked = false;
            el.classList.remove('active');
        });
        checkAmountActive();
    };

$('#typeField .boxes input').click(function () {
    $(this).toggleClass('active');
    checkAmountActive();
});

function checkAmountActive() {
    var amountActive = $('#typeField .boxes input.active').length;

    if (amountActive == $('#typeField .boxes input').length) {
        select.classList.add('inactive');
    }
    else {
        select.classList.remove('inactive');
    }

    if (amountActive == 0) {
        deselect.classList.add('inactive');
    }
    else {
        deselect.classList.remove('inactive');
    }
}

var submitButton = document.getElementById('submitButton');
var form = document.getElementById('selectForm');

submitButton.onclick = function () {
   form.submit();
}