I simplified the problem as follows:
This is my js code.
In this card, I press the button, and the content with ID “text” will be hidden or display.
When I get to the next card, I want to keep the operation effect of pressing the button.
For example, when I press the button on the first card, “text” is hidden;
Then the second card will hide “text” without pressing the button.
I want to look it up on the internet, but I don’t know how to ask questions.
I am a beginner about js, and I would appreciate any help.
Maybe the method is quite complicated.
Is there a related function?
I can study by myself.
You could set window.someVariable to true, and then check if it’s true when showing each card.
Oh, it’s amazing. dae.
I can use “window.variable” to pass variables between many cards, except the first card.
Is there any way to retrieve the variables left over from the last review when reviewing the first card?
Js runtime default id = “text” node display.
Suppose I reviewed the last card yesterday and set the node with ID = “text” to be hidden.
When I opened the first card today, I hoped it was still hidden.
(I tried to use window.varible, it didn’t work in the first picture, but it worked in the second and after.)
Excuse me, is there any relevant variable setting to complete it?
You can use
localStorage.setItem("someVariable", "Value"); and
localStorage.getItem("someVariable"); for this purpose
Thank you very much.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.