Skip to content

Instantly share code, notes, and snippets.

@freaktechnik
Last active April 26, 2024 22:10
Show Gist options
  • Select an option

  • Save freaktechnik/8bd895b49812faddd0033532ce7999f3 to your computer and use it in GitHub Desktop.

Select an option

Save freaktechnik/8bd895b49812faddd0033532ce7999f3 to your computer and use it in GitHub Desktop.
<select id="resolution">
<option value="1080p60" label="1080p 60FPS">
<option value="720p" label ="720p 30FPS">
<option value="mp3" label="Audio only (mp3)">
</select>
<script src="index.js"></script>
const valueMap = {
"1080p60": {
res: "1080p60",
type: "video"
},
"720p": {
res: "720p30",
type: "video"
},
"mp3": {
res: "",
type: "audio"
}
};
document.getElementById("resolution").addEventListener("change", function(e) {
const details = valueMap[this.value];
/* If "1080p60" is selected, details will be
* {
* "res": "1080p60",
* "type": "video"
* }
*/
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment