Untitled
unknown
plain_text
2 years ago
1.0 kB
7
Indexable
$(document).ready(function () {
scopeRadios = $('input[name="scope"]');
categorySelect = $('#category');
sourceSelect = $('#source');
unitInput = $('#unit');
unitInput2 = $('#unit2').hide(); // hide second input box by default
carbonFactorInput = $('#carbonfactor');
resultInput = $('#result');
commentInput = $('#comment');
charCount = $('#charCount');
// Event bindings
scopeRadios.change(onScopeChange);
categorySelect.change(onCategoryChange);
sourceSelect.change(onSourceChange);
unitInput.add(unitInput2).on('input', onUnitInputChange);
commentInput.on('keyup', onCommentKeyUp);
$('#submit').click(onSubmitClick);
$('#clear').click(onClearClick);
// Initialize form state
resetForm();
// Trigger change event on the first scope radio button to initialize categories
scopeRadios.first().trigger('change');
});Editor is loading...