Untitled
unknown
plain_text
2 years ago
986 B
6
Indexable
sourceSelect.change(function () {
unitInput.val('');
unitInput2.val('').hide();
let selectedScope = $('input[name="scope"]:checked').val();
let selectedCategory = categorySelect.val();
let selectedSource = $(this).val();
let selectedData = data.find(item => item.scope == selectedScope && item.category == selectedCategory && item.source == selectedSource);
let units = selectedData.unit.split(";");
$('#unit-label').text('Input (' + units[0] + ')');
unitInput.show().parent().addClass('col-12').removeClass('col-8 col-4'); // make full width
if (units.length > 1) {
$('#unit-label2').text('Input (' + units[1] + ')');
unitInput2.show().parent().addClass('col-6').removeClass('col-8 col-4'); // make half width
unitInput.parent().removeClass('col-12').addClass('col-6'); // make half width
} else {
$('#unit-label2').text('');
}
carbonFactorInput.val(selectedData.carbonfactor);
});
Editor is loading...