title: i have to clear existing value in the select option value
body: <p>i got solution by using this code</p>
  
  <pre><code>var module_list = document.getElementById("taModule");
  $("#taModule").empty();  //this is the solution code
  for(i=0;i&lt;pid.length;i++){
  if (pid[i] == projid){
  var option = document.createElement("option");              
  option.text = mname[i];
  option.value = mid[i];
  module_list.appendChild(option);
  }   
  }
  </code></pre>
  
  <p>Hi i have to dropdown list box. one have list of values like projects. second one is module dropdown list so, when the client select particular project. to list the module related to project. 
  javascript:</p>
  
  <pre><code>function populate(val) {
          var projid = val;
          var pid = new Array();
          var mid = new Array();
          var mname = new Array();
  
          pid = &lt;?php echo json_encode($pid); ?&gt;;
          mid = &lt;?php echo json_encode($mid); ?&gt;;
          mname = &lt;?php echo json_encode($mname); ?&gt;;
  var module_list = document.getElementById("taModule");
  $('#taModule').val('');     
                  for(i=0;i&lt;pid.length;i++){
              if (pid[i] == projid){
              var option = document.createElement("option");
                  option.text = mname[i];
                  option.value = mid[i];              
                  module_list.appendChild(option);
              }   
          }
      }
  </code></pre>
  
  <p>html code:</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;&lt;label for="taProj"&gt;&lt;?php echo t('Project')?&gt;:&lt;/label&gt;&lt;/td&gt;         
      &lt;td&gt;&lt;select name="taProj" id="taProj" onchange= "populate(this.value)"&gt;
      &lt;option value="" &gt;-------------------------&lt;/option&gt;
      &lt;?php   foreach ($tap as $row){?&gt;
      &lt;option value="&lt;?php echo $row['proj_id']; ?&gt;" &gt;&lt;?php echo $row['proj_name'];?&gt;&lt;/option&gt; &lt;?php } ?&gt;
      &lt;/select&gt;&lt;/td&gt;
      &lt;/tr&gt;       
      &lt;tr&gt;                        
      &lt;td&gt;&lt;label for="taModule"&gt;&lt;?php echo t('Module Name')?&gt;:&lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;select name="taModule" id="taModule" &gt;
      &lt;option value="" &gt;-------------------------&lt;/option&gt;
      &lt;/select&gt;&lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>
  
  <p>if i select the project, it show the related modules but if again i select other project the related module added with the existing module list. so i want to avoid this. i try some script remove, null and empty is not workig ., please any one suggest me and point out me how to achieve this task thank you</p>
  
  <p>Kumar</p>