I am trying to use cookie to compare to a dropdown and preselect the dropdown upon a match.
Here is what I am trying so far...
This doesn't even persist the dropdown selection in the same session. I don't see the pop-ups (alert and prompt) neither. And same when I log back in, it won't show my previous selection (in my last session) .
Eric Pascarello wrote:not sure why you would be using this there. This scope would be the window and not the form.
would be the correct way to access a form element.
I followed your code and had it working. But the code is only getting executed when the screen gets loaded (all my code is in window.onload). The form has a button (along with dropdown). In the onSubmit I again have to call setCookie with the new user selection (in dropdown).
Trilochan Bharadwaj wrote:
I'd use attachEventListener personally.
I didn't get your point. My form code is like this.