title: Stay on selected item on drop down menu using Javascript
body: <p>What is happening is I'm trying to get the drop-down menu to STAY on what was selected but it keeps switching to the default after I hit submit. Can someone help me with the javascript code because I know for sure that's the issue? Thanks everyone I'm trying to self-learn this.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function GetSelectedItem(){
     var option = document.getElementById("locale").value;
  }
  //THIS WON'T WORK?
  function StayOnSelectedItem(){
     var element = document.getElementById("locale");
     var value = element.options[element.selectedIndex].value;
    }
    </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;  
  &lt;html lang="en"&gt;
    &lt;head&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;title&gt;My Website toolbar&lt;/title&gt;
        &lt;link rel="stylesheet" href="languageswitcher.css"&gt;
    &lt;/head&gt;
   
    &lt;body&gt;
   
      &lt;header&gt;
   
        &lt;div id="country-select"&gt;
          &lt;form action="" method = "get"&gt;
            &lt;select id= "locale" name="locale"&gt;
     &lt;option value="en_US"&gt;English(US)&lt;/option&gt;
     &lt;option value="en_GB"&gt;English(UK)&lt;/option&gt;
                   &lt;option value="bg_BG"&gt;Bulgarian&lt;/option&gt;
                   &lt;option value="cs_CS"&gt;Czech&lt;/option&gt;
                   &lt;option value="da_DK"&gt;Danish&lt;/option&gt;
     &lt;option value="de_DE"&gt;German&lt;/option&gt;
     &lt;option value="ek_GR"&gt;Greek&lt;/option&gt;
     &lt;option value="es_ES"&gt;Spanish&lt;/option&gt;
                &lt;option value="et_ET"&gt;Estonian&lt;/option&gt;
     &lt;option value="fi_FI"&gt;Finnish&lt;/option&gt;
     &lt;option value="fr_FR"&gt;French&lt;/option&gt;
     &lt;option value="hu_HU"&gt;Hungarian&lt;/option&gt;
     &lt;option value="it_IT"&gt;Italian&lt;/option&gt;
     &lt;option value="lt_LT"&gt;Lithuanian&lt;/option&gt;
     &lt;option value="lv_LV"&gt;Latvian&lt;/option&gt;
     &lt;option value="nl_NL"&gt;Dutch&lt;/option&gt;
     &lt;option value="no_NO"&gt;Norwegian&lt;/option&gt;
     &lt;option value="pl_PL"&gt;Polish&lt;/option&gt;
     &lt;option value="pt_PT"&gt;Portugese&lt;/option&gt;
     &lt;option value="ro_RO"&gt;Romanian&lt;/option&gt;
     &lt;option value="sk_SK"&gt;Slovak&lt;/option&gt;
     &lt;option value="sl_SL"&gt;Slovenian&lt;/option&gt;
     &lt;option value="sv_SE"&gt;Swedish&lt;/option&gt;
            &lt;/select&gt;
            &lt;input value="Select" type="submit" /&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      &lt;/header&gt;
      &lt;script src="languageswitcher.js"&gt;&lt;/script&gt;
    
   &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>