File size: 524 Bytes
bdd842c
 
 
 
 
 
 
 
 
 
 
 
 
 
76d4a74
bdd842c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export async function setup_temperature_on_select(default_option = null) {
    var select = $("#temperature-select");
    select.empty();
    if (default_option === null) {
        default_option = "0";
    }
    for (let i = 10; i >= 0; i--) {
        const value = i / 10;
        const option = new Option(value, value);
        select.append(option);
        if (value === Number(default_option)) {
            $(option).prop("selected", true);
        }
    }
    console.log(`default_temperature: ${select.val()}`);
}