facebook

Problem with overwriting toggles

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #327693 Reply

    Max87
    Member

    Hi guys,
    I decided to add Settings option to my game.
    The goal is, that user can choose, if the alarm would be sound or vibrate. I have two toggles.
    But every time when I restart game/reload page, the default settings are loaded(beep, no vibrate).
    I have several if/else statement, depending on what user wants. I store the setting value in Local Storage and when page/game reloads(because default settings are loaded from Design center), I overwrite default settings of the toggles by following example code:

    
    var status = window.localStorage.getItem(stav, checkedToggle);
      
                   
              elementToggle2 = document.getElementById("m1-settings-toggle2");
              elementToggle1 = document.getElementById("m1-settings-toggle1");
              
              if(elementToggle1 && status==1) 
               {
               elementToggle1.innerHTML = '<input type="checkbox" name="toggle1" checked="true" data-action-change-id="action15"/>';   
               toggle();
               }
              
               if(elementToggle1 && status==2) 
               {
               elementToggle1.innerHTML = '<input type="checkbox" name="toggle1" data-action-change-id="action15"/>';   
               toggle();
               }
    

    The problem is, when I firstly overwrite toggles, they are no longer responding to onChange action, so I can overwrite them only once.
    Can anybody please help with this?
    Thanks

Viewing 1 post (of 1 total)
Reply To: Problem with overwriting toggles

You must be logged in to post in the forum log in