Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javascript – Remember what was selected after refresh

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32896
    jcoder
    Member

    Hi all,

    I have a simple drop down that allows you to choose a country. On my site if the address in the form comes out wrong it refreshes the page and brings up a validation box. If someone choses Canada it defaults back to the US when the page refreshes. With javascript could it remember Canada after the refresh?



    #75176
    TheDoc
    Member

    You could simply store some cookies, you could do javascript to accomplish this. Can’t really give you much more than that as I’m not proficient enough in JS, but ‘cookies’ are what you’re looking for.

    #75165
    jcoder
    Member

    Great! I’ll give this a try.

    #75166
    TT_Mark
    Member

    Yep, as JavaScript is client-side, the only thing you’ll be able to do is set cookies. It’s nice and easy, just set the cookie when they choose Canada and then read it on page load

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.