Update script.js
Browse files
script.js
CHANGED
|
@@ -71,32 +71,3 @@ async function convertCurrency() {
|
|
| 71 |
console.error(error);
|
| 72 |
}
|
| 73 |
}
|
| 74 |
-
// Activate Select2
|
| 75 |
-
$(document).ready(function () {
|
| 76 |
-
$('#fromCurrency, #toCurrency').select2();
|
| 77 |
-
});
|
| 78 |
-
|
| 79 |
-
// Swap functionality
|
| 80 |
-
document.getElementById('swapButton').addEventListener('click', function () {
|
| 81 |
-
const fromCurrency = document.getElementById('fromCurrency');
|
| 82 |
-
const toCurrency = document.getElementById('toCurrency');
|
| 83 |
-
|
| 84 |
-
// Swap the values
|
| 85 |
-
const temp = fromCurrency.value;
|
| 86 |
-
fromCurrency.value = toCurrency.value;
|
| 87 |
-
toCurrency.value = temp;
|
| 88 |
-
|
| 89 |
-
// Reinitialize Select2 to reflect the changes
|
| 90 |
-
$('#fromCurrency, #toCurrency').select2();
|
| 91 |
-
});
|
| 92 |
-
|
| 93 |
-
// Convert functionality placeholder
|
| 94 |
-
document.getElementById('convertButton').addEventListener('click', function () {
|
| 95 |
-
const amount = document.getElementById('amount').value;
|
| 96 |
-
const fromCurrency = document.getElementById('fromCurrency').value;
|
| 97 |
-
const toCurrency = document.getElementById('toCurrency').value;
|
| 98 |
-
|
| 99 |
-
// For now, just show a placeholder message
|
| 100 |
-
document.getElementById('result').textContent = `Converted ${amount} ${fromCurrency} to ${toCurrency}.`;
|
| 101 |
-
});
|
| 102 |
-
|
|
|
|
| 71 |
console.error(error);
|
| 72 |
}
|
| 73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|