I've made a modal popup using CSS by following this tutorial: http://www.script-tutorials.com/css3-modal-popups/
I'm wondering how to store the value that someone enters in a textbox as session data? I saw on another tutorial this code, say I wanted to get the email that someone typed and put it in session storage:
(function () {
var text = document.getElementById('email');
text.addEventListener('keyup', function () {
sessionStorage.text = text.value;
}, false);
});
For some reason, it doesn't seem to be working when I try the code below (on another page, not in the modal popup itself), the text doesn't show up
document.getElementById('storage').innerHTML = 'Your stored value is ' + sessionStorage.text;
Is there some special considerations when working with modal popups that I'm missing?
Edit:
I forgot to mention that the second line of code is in another tab/window, if that makes a difference. And I get these errors: TypeError: document.getElementById(...) is null ReferenceError: $ is not defined
From the comments I can gather so far, it seems like you can't do this from a popup window.. I am wondering if there is a cheat way of sending it back to the parent window and then from the parent window, save the text in session storage?