Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
2
Indexable
...
<div class="row">
    <div id="unit-container" class="col-8">
        <label id="unit-label">Inmatning</label>
        <input type="text" id="unit" class="form-control">
    </div>
    <div id="unit2-container" class="col-4" style="display: none;">
        <label id="unit-label2"></label>
        <input type="text" id="unit2" class="form-control">
    </div>
    <div class="col-4">
        <label>Resultat CO2e</label>
        <input type="text" id="result" class="form-control" disabled>
    </div>
</div>
...






...
sourceSelect.change(function () {
    ...
    if (units.length > 1) {
        $('#unit-label2').text('Input (' + units[1] + ')');
        $('#unit2-container').show();
        $('#unit-container').removeClass('col-8').addClass('col-4');
    } else {
        $('#unit-label2').text('');
        $('#unit2-container').hide();
        $('#unit-container').removeClass('col-4').addClass('col-8');
    }
    carbonFactorInput.val(selectedData.carbonfactor);
});

$('#clear').click(function() {
    ...
    categorySelect.prop('selectedIndex', 0).attr('disabled', false);
    sourceSelect.prop('selectedIndex', 0).attr('disabled', false);
    ...
});

scopeRadios.change(function () {
    ...
    categorySelect.attr('disabled', false);
    ...
});
...