2020年12月31日星期四

Save variables globally from radio input

Having the following htmt and function. I can't get var skinColor to save "light" or "dark" after i click my button. How do i need to define the so when i select a radio button it saves the var globally ? I get a skinColor not defined error , but that is the point , i'm trying to defined skinColor.

<input type="radio" id="load_lightskin" name="skin" value="light_skin">  <label for="light_skin">Light Skin</label>    <input type="radio" id="load_darkskin" name="skin" value="dark_skin">  <label for="dark_skin">Dark Skin</label>    <input id="InstallerSettings" type="button" onclick="SkinSettings()" value="Continue Install">    function SkinSettings(){    switch ($('input[name="skin"]:checked').val()){      case "light_skin":        var skinColor = "light";        load_template();        break;      case "dark_skin":        var skinColor = "dark";        load_template();        break;      default:         alert("You must select a skin to continue.");       break;    }  }  
https://stackoverflow.com/questions/65527006/save-variables-globally-from-radio-input January 01, 2021 at 10:54AM

没有评论:

发表评论