title: How do I add images in this select list? Javascript?
body: <p>I have all the images of the countries but how would I add the image before the name of the language on visual? Basically I want the country flag to show up on each selection. Thanks for your help this is as much detailed I can be.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&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="none"&gt;Select A Language&lt;/option&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&gt;
  
  
        //Main Function: creates the page dynamically &amp; switches the url to selected country
        function GetSelectedItem() {
          var option = document.getElementById("locale").value;
        }
     
     //Main Function: Split the string of the URL
     function getParameterByName(name, url) {
    //Retrieves website URL
    if (!url) url = window.location.href;
    //Replaces the 1st parameter with the 2nd parameter
    name = name.replace(/[\[\]]/g, "\\$&amp;");
    //Takes all the regular expressions and results is the value we need
    var regex = new RegExp("[?&amp;]" + name + "(=([^&amp;#]*)|&amp;|#|$)"), results = regex.exec(url);
    //If empty or none are in there return Null
    if (!results) return null;
    //If the URL name doesn't have anything in index 2 return empty stress
    if (!results[2]) return '';
    //Return the value without the regular expressions.
    return decodeURIComponent(results[2].replace(/\+/g, " "));
     }
     
     //Set variable to the splitted string (e.g. en_GB would be the value inside of the getParameterByName()
     var localeVariable = getParameterByName('locale');
     //Make the drop down menu stay on the country selected
     var temp = localeVariable;
     //Determine with for loop to go through each country with the countring variable j
     for(var i, j = 0; i = locale.options[j]; j++){
     //if value matches go in the if to make the value the selected index
    if(i.value == temp){
     //set whatever j equaled to the selected index.
     locale.selectedIndex = j;
     break; //Break if value matches
    }
     }
     
    &lt;/script&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>