title: Trying to set default value of <option> from local.storage
body: <p>i am currently creating an API with a login system where i would like my users to be able to update their user information. 
  I have a registration page where they fill in some forms and 's which i then post to my database with a AJAX POST.
  I almost copied the exact HTML, and jQuery.AJAX for the edit user page and it works! :D
  Now i would like to get the data that already exist in the database, and fill the forms/inputs &amp; dropdowns/'s on the edit user page.
  i am able to do this by making a variable containing localstorage.get('user').THE-DATA-I-WANT-TO-FILL-IN;
  then for the 's i am making a if or else conditional statement, as seen below.</p>
  
  <p>Here is the jquery function with my HTML view for; edit user page.</p>
  
  <pre><code>function editUserPage() {
  
  var user = store.get('user');
  
  var first_name = store.get('user').first_name;
  var last_name = store.get('user').last_name;
  var email = store.get('user').email;
  var gender = store.get('user').gender;
  var dateofbirth = store.get('user').dateofbirth;
  var phone_number = store.get('user').phone_number;
  var address = store.get('user').address;
  var city = store.get('user').city;
  var zipcode = store.get('user').zipcode;
  var country = store.get('user').country;
  var nationality = store.get('user').nationality;
  var speak_danish = store.get('user').speak_danish;
  var colleague = store.get('user').colleague;
  var task = store.get('user').task;
  var genderSelected ='';
  var danishSelected = '';
  var countrySelected = '';
  
  if(gender = '1') {
      genderSelected = 
      '&lt;select id="gender" name="gender" placeholder="Gender"&gt;'
          +'&lt;option value="" disabled selected&gt;Gender&lt;/option&gt;'
          +'&lt;option value="1" selected&gt;Female&lt;/option&gt;'
          +'&lt;option value="0"&gt;Male&lt;/option&gt;'
      +'&lt;/select&gt;';
  }
  else {
      genderSelected = 
      '&lt;select id="gender" name="gender" placeholder="Gender"&gt;'
          +'&lt;option value="" disabled selected&gt;Gender&lt;/option&gt;'
          +'&lt;option value="1"&gt;Female&lt;/option&gt;'
          +'&lt;option value="0" selected&gt;Male&lt;/option&gt;'
      +'&lt;/select&gt;';
  }
  
  if(speak_danish = '1') {
      danishSelected =
      '&lt;select id="speak_danish" name="speak_danish"&gt;'
                  +'&lt;option value="danish" disabled selected&gt;Speak and understand Danish&lt;/option&gt;'
                  +'&lt;option value="1" selected&gt;Yes&lt;/option&gt;'
                  +'&lt;option value="0"&gt;No&lt;/option&gt;'
      +'&lt;/select&gt;';
  } 
  else {
      danishSelected =
      '&lt;select id="speak_danish" name="speak_danish"&gt;'
          +'&lt;option value="danish" disabled selected&gt;Speak and understand Danish&lt;/option&gt;'
          +'&lt;option value="1"&gt;Yes&lt;/option&gt;'
          +'&lt;option value="0" selected&gt;No&lt;/option&gt;'
      +'&lt;/select&gt;';
  }
  
  
  var html = 
  '&lt;div class="register-text container"&gt;'
          +'&lt;h3&gt;You are about to register as a volunteer for&lt;/h3&gt;'
          +'&lt;img src="' + RESS +'img/tinderbox_date.svg"&gt;'
      +'&lt;/div&gt;'
      +'&lt;div class="register-input container"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="email"&gt;Email Address&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="email" type="email" name="email" placeholder="Email" value="' + email + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="password"&gt;Password&lt;/label&gt;'
              +'&lt;br&gt;' 
              +'&lt;input id="password" type="password" name="password" placeholder="Password"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="first_name"&gt;First Name&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="first_name" type="text" name="first_name" placeholder="First Name" value="' + first_name + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="last_name"&gt;Last Name&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="last_name" type="text" name="last_name" placeholder="Last Name" value="' + last_name + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="gender"&gt;Gender&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;div class="dropdown-style"&gt;'
              +   genderSelected
              +'&lt;/div&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="dateofbirth"&gt;Date of Birth&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="dateofbirth" placeholder="Date of Birth" type="date" name="dateofbirth" value="' + dateofbirth + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="nationality"&gt;Nationality&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;div class="dropdown-style"&gt;'
              +'&lt;select id="nationality" name="nationality" &gt;'
                  +'&lt;option value="nationality" disabled selected&gt;Nationality&lt;/option&gt;'
                  +'&lt;option value="Danish"&gt;Danish&lt;/option&gt;'
                  +'&lt;option value="German"&gt;German&lt;/option&gt;'
                  +'&lt;option value="norwegian"&gt;Norwegian&lt;/option&gt;'
              +'&lt;/select&gt;'
              +'&lt;/div&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="upload-image"&gt;Upload Image&lt;/label&gt;'
              +'&lt;br&gt;'
  
              +'&lt;div class="upload-image"&gt;'
                  +'&lt;img src="images/picture.svg"&gt;'
                  +'&lt;p&gt;Upload image&lt;/p&gt;'
              +'&lt;/div&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="phonenumber"&gt;Phonenumber&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="phonenumber" type="text" name="phonenumber" placeholder="Phonenumber" value="' + phone_number + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="address"&gt;Address&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="address" type="text" name="address" placeholder="Address"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="countryId"&gt;Country&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;div class="dropdown-style"&gt;'
              + '&lt;select name="country" class="countries" id="countryId"&gt;'
              + '&lt;option value="" disabled&gt;Select Country&lt;/option&gt;'
              + '&lt;/select&gt;'
              +'&lt;/div&gt;'
              + '&lt;script src="http://lab.iamrohit.in/js/location.js"&gt;&lt;/script&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="zipcode"&gt;ZIP&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="zipcode" type="text" name="zipcode" placeholder="Zip code" value="' + zipcode + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="city"&gt;City&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="city" input="city" type="text" name="city" placeholder="City" value="' + city + '"&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="speak_danish"&gt;Speak and understand Danish&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;div class="dropdown-style"&gt;'
              + danishSelected
              +'&lt;/div&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="task"&gt;Preferred work tasks&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;div class="dropdown-style"&gt;'
              +'&lt;select id="task" name="task"&gt;'
                  +'&lt;option value="tasks" label disabled selected&gt;Preferred work tasks&lt;/option&gt;'
                  +'&lt;option value="fences"&gt;Building Fences&lt;/option&gt;'
                  +'&lt;option value="bartender"&gt;Bartender&lt;/option&gt;'
                  +'&lt;option value="it-work"&gt;IT Work&lt;/option&gt;'
              +'&lt;/select&gt;'
              +'&lt;/div&gt;'
              +'&lt;br&gt;'
              +'&lt;label for="colleague"&gt;Preferred Colleague&lt;/label&gt;'
              +'&lt;br&gt;'
              +'&lt;input id="colleague" type="text" name="colleague" placeholder="I like to work with (name)" value="' + colleague + '"&gt;'
              +'&lt;button class="link-register-user" type="submit" value="REGISTER"&gt;Register&lt;/button&gt;'  
      +'&lt;/div&gt;';
  
  jQuery('#main').html(html); 
  </code></pre>
  
  <p>Like i wrote, the AJAX call im using to update after the user entered his new info, is also the exact same as from my registration, with the exception of POST being PUT/PATCH. (let me know if i should ad it too, but i dont think its that relevant, beacause it works and is not the prob here)</p>
  
  <p>SO enough introduction (i think). 
  Now the actual problem i want help with is that in my  dropdowns, i want to set the value to whatever they chose the first time in the registration and is therefore im my DB. right now i am doing: 
  if (some option is chosen) { show the HTML where this option is chosen }
  else (the other option is chosen) { show the HTML where the other option is chosen }
  but when i have a dropdown like Country where i am getting all the possible options from an external jQuery script, 
       
  i cant make a if(){}elseif(){}elseif(){}elseif(){}, for every single option, when there is more then 200 :( </p>
  
  <p>thank you for the help in advance, and btw am fairly new to stackoverflow and coding in general, so bear with me, and let me know if i should share more code, for you to get the understanding of it to help me out ;=)</p>