Update script.js
Browse files
script.js
CHANGED
@@ -25,19 +25,20 @@ swapButton.addEventListener('click', async () => {
|
|
25 |
await convertCurrency();
|
26 |
});
|
27 |
|
28 |
-
// Input perubahan
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
});
|
35 |
|
|
|
|
|
36 |
element.addEventListener('change', () => {
|
37 |
// Reset status jika mata uang diubah
|
38 |
autoConvert = false;
|
39 |
-
convertButton.style.display = 'block';
|
40 |
-
resultDiv.innerHTML = '';
|
41 |
});
|
42 |
});
|
43 |
|
|
|
25 |
await convertCurrency();
|
26 |
});
|
27 |
|
28 |
+
// Input perubahan jumlah
|
29 |
+
amountInput.addEventListener('input', async () => {
|
30 |
+
if (autoConvert) {
|
31 |
+
await convertCurrency(); // Konversi otomatis
|
32 |
+
}
|
33 |
+
});
|
|
|
34 |
|
35 |
+
// Perubahan mata uang
|
36 |
+
[fromCurrency, toCurrency].forEach(element => {
|
37 |
element.addEventListener('change', () => {
|
38 |
// Reset status jika mata uang diubah
|
39 |
autoConvert = false;
|
40 |
+
convertButton.style.display = 'block'; // Tampilkan tombol Convert
|
41 |
+
resultDiv.innerHTML = ''; // Kosongkan hasil
|
42 |
});
|
43 |
});
|
44 |
|