So, I want the make generator to remember user inputs and the latest generated output using the remember plugin, it works on user input but not for the output. I know there's a solution for this since generators like AI Chat can remember the chat logs without problem but I'm too dumb to understand the code lol

Also, how can I prevent the AI to automatically generate output on first load? I'm using the firstload = true tingy but I want to make it look cleaner when the generator loads since it 's displaying the [firstLoad ? "" : output] for a split second, is there any other method for this?

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 1 point 2 years ago* (last edited 2 years ago) (1 child)

Sorry for the late response, unfortunately, I'm just started learning coding recently, especially JS, I might need to read a bit more about this lol thanks for the link!

EDIT: Just wanted to let you know that I've figured out a solution thanks to the AI code helper, it basically wrote the similar function:

// Function to load data from local storage when the page loads
  function loadData() {
    userInputEl.value = localStorage.userInput || ""; // Load user input
    aiOutputEl.value = localStorage.aiOutput || ""; // Load AI output
  }

  // Function to save data to local storage whenever there's an input change
  function saveData() {
    localStorage.userInput = userInputEl.value; // Save user input
    localStorage.aiOutput = aiOutputEl.value; // Save AI output
  }

window.onload = loadData;

And just simply put the oninput="saveData() into both input and output elements.

  • source
  • parent
  • hideshow 1 child comment