title: Function call works only for first call in Javascript
body: <p>I am working on a spell checker, where it shows a drop-down menu with suggestions beside every incorrect word. Whenever I click ANY drop-down list to select the suggested correct word,it changes only for the FIRST incorrect word. However, I wanted to change each incorrect word by clicking each drop-down menu suggestion separately just like typical spell checker works.</p>
  
  <p>I think I should bring some changes in javascript function call on this line,</p>
  
  <pre><code>echo "&lt;select onChange='changeFunc()'  id='selectCorrct' style='border:none; width:15px; '  required&gt;
                          &lt;option value=''&gt;&lt;/option&gt;";
  </code></pre>
  
  <p>The code-sample  is below:</p>
  
  <pre><code>echo "&lt;font id='change_word'  style=\"color:red; font-size:23px;\"&gt;$input&lt;/font&gt;";
                  echo "&lt;select onChange='changeFunc()'  id='selectCorrct' style='border:none; width:15px; '  required&gt;
                          &lt;option value=''&gt;&lt;/option&gt;";
  
                  $name='';
                  if(sizeof($temp_word_soundex) &lt;= 5){
                      for($k=0;$k&lt;sizeof($temp_word_soundex);$k++){
  
                          $specific = explode(" ",$temp_word_soundex[$k]);
                          $name = $name.$specific[1]." | ";
                          echo "&lt;option value='$specific[1]' style=\"color:black; font-size:23px;\"&gt;$specific[1]&lt;/option&gt;";   
                      }
                  }
                  else
                  {
                      for($k=0;$k&lt;5;$k++){
                          $specific = explode(" ",$temp_word_soundex[$k]);
                          $name = $name.$specific[1]." | ";
                          echo "&lt;option value='$specific[1]'   style=\"color:black; font-size:23px;\"&gt;$specific[1]&lt;/option&gt;";     
                      }
                  }
  
                  echo "&lt;/select&gt;";
  </code></pre>
  
  <p>//////////// JAVASCRIPT CODE BELOW /////////</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
      function changeFunc(){
          var a = document.getElementById('selectCorrct').value;
          document.getElementById('change_word').innerHTML=a;
          document.getElementById('change_word').style.color='green';
  
  
      }
  
  &lt;/script&gt;
  </code></pre>