title: Populating form fields on change of drop down using javascript
body: <p>I am trying to populate data in my fields depending on the value selected in the drop down box. I have passed the dropdown option select to the javascript function, but having problem in updating the form fields. Please check my code for the error I've committed.</p>
  
  <p>This is my html code:</p>
  
  <pre><code> &lt;div class="form-ui"&gt;
        &lt;span class="form-elements reqField"&gt;
            &lt;select class="dropdown" onchange="populateData(this.options[this.selectedIndex].value,1)"&gt;
                &lt;option value="1"&gt;Please Select&lt;/option&gt;
                &lt;option value="2"&gt;Mrs.Jane Smith&lt;/option&gt;
                &lt;option value="3"&gt;Mr.Junior Smith&lt;/option&gt;
            &lt;/select&gt;
        &lt;/span&gt;
  
        &lt;span class="form-elements reqField"&gt;
             &lt;select id="itle1" class="dropdown"&gt;
                &lt;option value="1"&gt;Mr.&lt;/option&gt;
                &lt;option value="2"&gt;Ms.&lt;/option&gt;
                &lt;option value="3"&gt;Mrs.&lt;/option&gt;
             &lt;/select&gt;
       &lt;/span&gt;
  
      &lt;span class="form-elements"&gt;
            &lt;input id="FirstName1" type="text" class="text" value="" /&gt;
      &lt;/span&gt;
  
      &lt;span class="form-elements reqField"&gt;
            &lt;input id="LastName1" type="text" class="text" value="" /&gt;
      &lt;/span&gt;
     &lt;/div&gt;
  </code></pre>
  
  <p>And the javascript code:</p>
  
  <pre><code> function populateData(value,person){
      if(value==2){
          $('#Title'+person).value=3;
          $('#FirstName'+person).value="Jane";
          $('#LastName'+person).value="Smith";
      }
     if(value==3){
  
     }
  
   }
  </code></pre>