$(document).ready(function() { //Change selectboxes $(".van").change(function() { var valVAN = parseFloat($(this).val()); var elTOT = $(this).nextUntil(".span", ".tot"); var valTOT = parseFloat($(this).nextUntil(".span", ".tot").val()); // Krijg alle aanwezige opties (tot) var arrTOT = []; $(elTOT).children().each(function() { arrTOT.push($(this).val()); }); // Selecteer juiste optie (tot)(indien nodig) var arrTOTfilterEnabled = arrTOT.filter(function(x) { return parseFloat(x) > valVAN; }); if (arrTOTfilterEnabled[0] > valTOT) { $(elTOT).val(arrTOTfilterEnabled[0]); } // Reset alle opties (tot) $(elTOT).children().removeAttr('disabled'); // Disable opties (tot) var arrTOTfilterDisabled = arrTOT.filter(function(x) { return parseFloat(x) <= valVAN; }); for(var i=0; i