mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 17:53:55 +01:00
26 lines
585 B
TypeScript
26 lines
585 B
TypeScript
export function getSelectValue(selector: HTMLSelectElement | null): string {
|
|
if (selector == null) {
|
|
return "";
|
|
}
|
|
if (selector.options.length <= 0) {
|
|
return "";
|
|
}
|
|
if (selector.selectedIndex < 0) {
|
|
return "";
|
|
}
|
|
return selector.options[selector.selectedIndex].value;
|
|
}
|
|
|
|
export function getSelectText(selector: HTMLSelectElement | null): string {
|
|
if (selector == null) {
|
|
return "";
|
|
}
|
|
if (selector.options.length <= 0) {
|
|
return "";
|
|
}
|
|
if (selector.selectedIndex < 0) {
|
|
return "";
|
|
}
|
|
return selector.options[selector.selectedIndex].text;
|
|
}
|