JadeRavens made a post on Reddit about the remember-plugin not being able to ‘remember’ the radio buttons.

So, I made a modification of the remember-plugin that handles the radio button groups. Here is the demo generator for it.

Essentially, it takes the ‘group’ of the buttons (by using .querySelectorAll to select all inputs that have the same name of the radio button) then saving the state of each radio button.

Which means that in the group, only one is checked and the others are not checked.

Though I am having problems with the saving of the value of a variable since after the second reload of the page, it will point to the last value.

The steps to see the problem (if there is an update() in the oninput of the radio button) is:

  1. Click a radio button.
  2. Reload the page, the variable will point to the last value in the group.

If there is no update() on the oninput, it will take two reloads of the page to point to the last value in the group.

EDIT: Seems to have fixed it by removing the triggerEvent upon loading the state/value of the inputs. Though, I’m sure there is a good reason why the ‘triggerEvent’ are there.

  • VioneTOPM
    link
    English
    211 months ago

    Thank you for the kind words! I just like solving problems and try to increase my knowledge of JS/HTML/CSS through Perchance which is why I try to answer the questions on the forums (reddit, discord, and here), essentially helping myself (to learn new things and answers to the problems) by helping others. I’m also just doing it during my free time and when I don’t have any important things to do, so no need to worry about me xD. Lastly, thank you for creating this website and keeping it open ♥.