Created
April 10, 2025 10:36
-
-
Save prio101/65044455c2d5ca1ef02fa248d5516bee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const select = document.getElementById("current_currency"); | |
const options = Array.from(select.options); | |
// Remove and sort options | |
const sortedOptions = options.sort((a, b) => { | |
return a.text.localeCompare(b.text); | |
}); | |
// Clear existing options and re-add sorted ones | |
select.innerHTML = ""; | |
sortedOptions.forEach(option => select.appendChild(option)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment