GarGerry commited on
Commit
5a2d8ac
·
verified ·
1 Parent(s): 0645c10

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +10 -9
script.js CHANGED
@@ -25,19 +25,20 @@ swapButton.addEventListener('click', async () => {
25
  await convertCurrency();
26
  });
27
 
28
- // Input perubahan
29
- [amountInput, fromCurrency, toCurrency].forEach(element => {
30
- element.addEventListener('input', async () => {
31
- if (autoConvert) {
32
- await convertCurrency(); // Konversi otomatis
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