this post was submitted on 01 Nov 2023
1 points (100.0% liked)

Perchance - Create a Random Text Generator

0 readers
1 users here now

⚄︎ Perchance

This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.

Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)

See this post for the Complete Guide to Posting Here on the Community!


Rules

1. Please follow the Lemmy.World instance rules.

2. Be kind and friendly.

  • Please be kind to others on this community (and also in general), and remember that for many people Perchance is their first experience with coding. We have members for whom English is not their first language, so please be take that into account too :)

3. Be thankful to those who try to help you.

  • If you ask a question and someone has made a effort to help you out, please remember to be thankful! Even if they don't manage to help you solve your problem - remember that they're spending time out of their day to try to help a stranger :)

4. Only post about stuff related to perchance.

  • Please only post about perchance related stuff like generators on it, bugs, and the site.

Have fun generating! ⚄︎

founded 1 year ago
MODERATORS
 

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.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here