title: Get value of selected drop down list item
body: <p>Good Evening, i have these dynamically generated dropdown list in my JSP:`  </p>
  
  <pre><code>    &lt;td&gt;&lt;select name="model" id="model"  onchange="convertDropDownToTextBox()"&gt;
  
                              &lt;c:forEach items="${model_list}" var="item"&gt;
  
                                  &lt;option value="${item.modelId}"&gt;${item.modelName}&lt;/option&gt;
                              &lt;/c:forEach&gt;
                                                              &lt;option value="100"&gt;Add New Model&lt;/option&gt;
  
              &lt;/select&gt;&lt;/td&gt;
  </code></pre>
  
  <p>and i tried these script to get the selected value from these dropdown :</p>
  
  <pre><code>function convertDropDownToTextBox(){
      var select = document.getElementById("model");
      var selectedString = select.options[select.selectedIndex].value;
      alert(selectedString);
  }
  </code></pre>
  
  <p>the problem here is that it always gives 1 for every item selected in the dropdown however i f i changed the onChange to be <code>onchange="alert(this.value)"</code> it prints the right values!! how that come? and how to get the actual index of every item selected in the DropDown</p>