update init state

This commit is contained in:
solehudin5699
2022-02-27 23:24:05 +07:00
parent 8f6c0f1219
commit 9242e6d133
+7
View File
@@ -190,6 +190,7 @@
<script>
const formSubmit = document.getElementById('form-submit');
const btnBrowse = document.getElementById('btn-browse');
const btnSubmit = document.getElementById('btn-submit');
const inputFile = document.getElementById('input-file');
const anchorDonwload = document.getElementById('anchor-donwload');
const inputQuality = document.getElementById('quality-input');
@@ -198,6 +199,7 @@
const inputHeight = document.getElementById('height-input');
const checkboxOriSize = document.getElementById('original-size-input');
const setInitialState = (() => {
if (checkboxOriSize.checked) {
inputHeight.setAttribute('disabled', true);
inputWidth.setAttribute('disabled', true);
@@ -205,6 +207,9 @@
inputHeight.removeAttribute('disabled');
inputWidth.removeAttribute('disabled');
}
valueQuality.innerHTML = inputQuality.value;
btnSubmit.setAttribute('disabled', true);
})();
btnBrowse.addEventListener('click', (e) => {
inputFile.click();
@@ -227,6 +232,8 @@
btnBrowse.innerHTML = 'Change Image';
};
imageFile.src = URL.createObjectURL(file);
btnSubmit.removeAttribute('disabled');
});
inputQuality.addEventListener('change', (e) => {