Hey Velo Community!
Need a little assistance here with the codes I have… Here is the situation.
I have a page, lets call it Page A, that has 4 buttons that says register now
Each of this button has a onClick event that will be triggered when the button is pressed. It triggers this line of code before redirecting to the next page (the button is linked such that when you press it, it redirects to another page):
session.setItem("selectedOption", "0");
On the next page, let’s call it Page B, it will then retrieve this item from the sessionStorage to do certain actions…
let pressedBtn = session.getItem('selectedOption');
However, when Page B first loads, it retrieves the value as null rather then the stored value itself, and when I check the session storage in the browser, it does seem to have stored the value already.
Any thoughts on why I would need to reload the page after being directed there to get the values from the sessionStorage?
Any help would be greatly appreciated!
Thank you!