title: change selected option of dropDown using jQuery
body: <p>I have a dropdown on change a popup appears with a warning that change the value will do some affects. when user select no the dropdown selected index is supposed to return to initial selected option. here is what I do:</p>
  
  <pre><code>function closeDeleteVariantsPopup(){
          parent.$.fn.colorbox.close();
          var elementSpecies= parent.document.getElementsByClassName("speice");
          for(var i = 0;i&lt;elementSpecies[0].options.length; ++i) {
              alert(parent.document.getElementById("speciesHiddenValue").value);
              if(elementSpecies[0].options[i].id === parent.document.getElementById("speciesHiddenValue").value) {
                  alert(parent.document.getElementById("speciesHiddenValue").value);
                  elementSpecies[0].selectedIndex = i;
                  break;
              }
          }
      }
  </code></pre>
  
  <p>html &amp; freemarker:</p>
  
  <pre><code>[@spring.bind "genomicReferenceBean.specie.id"/]
  &lt;select name="specie.id" id="specie.id"  [#if !(genomicReferenceBean.specie?has_content) || genomicReferenceBean.specie.id==-1] multiple="multiple" [/#if] class='speice singleList'  onchange='getMaterials()' &gt;
  [#if genomicReferenceInitializerBean.species?has_content]
      [#list genomicReferenceInitializerBean.species as initializerValueBean]
          &lt;option for="selectSpecie" name="${initializerValueBean.name}" [#if genomicReferenceBean.specie?has_content &amp;&amp; genomicReferenceBean.specie.id?number == initializerValueBean.id] selected="selected" [/#if] value="${initializerValueBean.id}"&gt;${initializerValueBean.name}&lt;/option&gt;
      [/#list]
  [/#if]
  
  &lt;/select&gt;
  &lt;input type="hidden" id="speciesHiddenValue" value="${genomicReferenceBean.specie.id?number}"/&gt;
  </code></pre>
  
  <p>now when I press no button the popup close and nothing happen</p>