DOMSubtreeModified
? $(window).load(function() {
function countUnique(id) {
const listItems = document.querySelector(id).children
const set = new Set()
Array.from(listItems).forEach(elem => {
set.add(elem.textContent)
})
return set.size
}
$("#allcustomers").html(countUnique('#allcustomers'));
$("#chuvresp").html(countUnique('#chuvresp'));
$("#belgorod").html(countUnique('#belgorod'));
$("#bransk").html(countUnique('#bransk'));
$("#ivanovo").html(countUnique('#ivanovo'));
$("#kostroma").html(countUnique('#kostroma'));
$("#kaluga").html(countUnique('#kaluga'));
$("#kursk").html(countUnique('#kursk'));
$("#lipetsk").html(countUnique('#lipetsk'));
$("#moskwa").html(countUnique('#moskwa'));
$("#orel").html(countUnique('#orel'));
$("#razan").html(countUnique('#razan'));
$("#tula").html(countUnique('#tula'));
$("#smol").html(countUnique('#smol'));
$("#tambow").html(countUnique('#tambow'));
$("#vladimir").html(countUnique('#vladimir'));
$("#voronezh").html(countUnique('#voronezh'));
$("#yaroslavl").html(countUnique('#yaroslavl'));
$("#adigea").html(countUnique('#adigea'));
$("#astrahan").html(countUnique('#astrahan'));
$("#dagestan").html(countUnique('#dagestan'));
$("#chechna").html(countUnique('#chechna'));
$("#ingush").html(countUnique('#ingush'));
$("#kbr").html(countUnique('#kbr'));
$("#kalmik").html(countUnique('#kalmik'));
$("#kchr").html(countUnique('#kchr'));
$("#krasnodar").html(countUnique('#krasnodar'));
$("#stavropol").html(countUnique('#stavropol'));
$("#osetia").html(countUnique('#osetia'));
$("#rostov").html(countUnique('#rostov'));
$("#volgograd").html(countUnique('#volgograd'));
$("#nenets").html(countUnique('#nenets'));
$("#karelia").html(countUnique('#karelia'));
$("#kaliningrad").html(countUnique('#kaliningrad'));
$("#archangelsk").html(countUnique('#archangelsk'));
$("#komi").html(countUnique('#komi'));
$("#murmansk").html(countUnique('#murmansk'));
$("#piter").html(countUnique('#piter'));
$("#pskov").html(countUnique('#pskov'));
$("#novgorod").html(countUnique('#novgorod'));
$("#vologda").html(countUnique('#vologda'));
$("#evrei").html(countUnique('#evrei'));
$("#amur").html(countUnique('#amur'));
$("#kamchatka").html(countUnique('#kamchatka'));
$("#habarovsk").html(countUnique('#habarovsk'));
$("#primorie").html(countUnique('#primorie'));
$("#chukotka").html(countUnique('#chukotka'));
$("#magadan").html(countUnique('#magadan'));
$("#saha").html(countUnique('#saha'));
$("#sahalin").html(countUnique('#sahalin'));
$("#altai").html(countUnique('#altai'));
$("#altaikrai").html(countUnique('#altaikrai'));
$("#kemerovo").html(countUnique('#kemerovo'));
$("#buratia").html(countUnique('#buratia'));
$("#zabaikal").html(countUnique('#zabaikal'));
$("#hakasia").html(countUnique('#hakasia'));
$("#irkutsk").html(countUnique('#irkutsk'));
$("#krasnoyarsk").html(countUnique('#krasnoyarsk'));
$("#novosib").html(countUnique('#novosib'));
$("#omsk").html(countUnique('#omsk'));
$("#tomsk").html(countUnique('#tomsk'));
$("#tiva").html(countUnique('#tiva'));
$("#kurgan").html(countUnique('#kurgan'));
$("#tumen").html(countUnique('#tumen'));
$("#hmao").html(countUnique('#hmao'));
$("#sverdlovsk").html(countUnique('#sverdlovsk'));
$("#yanao").html(countUnique('#yanao'));
$("#chelabinsk").html(countUnique('#chelabinsk'));
$("#orenburg").html(countUnique('#orenburg'));
$("#bashkortostan").html(countUnique('#bashkortostan'));
$("#tatarstan").html(countUnique('#tatarstan'));
$("#saratov").html(countUnique('#saratov'));
$("#samara").html(countUnique('#samara'));
$("#perm").html(countUnique('#perm'));
$("#penza").html(countUnique('#penza'));
$("#ylianovsk").html(countUnique('#ylianovsk'));
$("#udmurtia").html(countUnique('#udmurtia'));
$("#mordovia").html(countUnique('#mordovia'));
$("#kirov").html(countUnique('#kirov'));
$("#mariel").html(countUnique('#mariel'));
$("#nizh").html(countUnique('#nizh'));
$("#krim").html(countUnique('#krim'));
$("#tver").html(countUnique('#tver'));
});
это для примера было)
P.S.: id="1" делать нельзя.
$('#power').html(data.map(n => `<option>${n['Мощность']}</option>`).join('')).val(null);
$('#number').html(Object.keys(data[0]['Частота вращения']).map(n => `<option>${n}</option>`).join('')).val(null);
$('#selects').change(function() {
const
power = $('#power').val(),
number = $('#number').val();
if (person && key) {
// $('#result').text(data.find(n => n['Мощность'] === power)['Частота вращения'][number]);
var checkres = data.find(n => n['Мощность'] === power)['Частота вращения'][number];
}
// alert (checkres);
$('.check').click(function () {
$('.check:checked').each(function () {
var price = $(this).val();
checkres *= price;
});
$('#result').text(checkres)
});
});