title: JavaScript change function on a select tag
body: <p>I want to change what is written in the input tag depending on what was chosen in the select tag. </p>
  
  <p>this is my select tag</p>
  
  <pre><code>&lt;div class="form-group col-lg-4"&gt;
      &lt;label for="donationType"&gt;Donation Type: &amp;nbsp;&lt;/label&gt; 
          &lt;select id="donationType" style="text-transform: capitalize"
                  name="volunteerProject.donationTypeId" class="form-control"&gt;
              &lt;option value='0'&gt;Select Donation Type&lt;/option&gt;
                  &lt;s:iterator value="donationTypeList"&gt;
                      &lt;option value='&lt;s:property value="donationTypeId" /&gt;'
                          name='&lt;s:property value="donationType" /&gt;'&gt;
                  &lt;s:property value="donationType" /&gt;
              &lt;/option&gt;
              &lt;/s:iterator&gt;
          &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and this is my input tag</p>
  
  <pre><code>&lt;div class="form-group col-lg-3" id="vpDonateButtonLabelDiv"&gt;
      &lt;label for="vpTitle"&gt;Button Label&lt;/label&gt; &lt;input
              type="text" class="form-control" id="vpDonateButtonLabel"
              name="volunteerProject.donateButtonLabel"
              placeholder="Enter button label" maxlength="50" required /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and here's my javascript code</p>
  
  <pre><code>$('#donationType').change( function() {
  
  var donationType = $(this).val();
  
      if (donationType != 0) {
          if (donationType == 1){
              $("#vpDonateButtonLabelDiv").append('Donate');
          } else if (donationType == 2) {
              $("#vpDonateButtonLabelDiv").append('Volunteer');
          } else if (donationType == 3) {
              $("#vpDonateButtonLabelDiv").append('Share');
          } else if (donationType == 5) {
              $("#vpDonateButtonLabelDiv").append('Tweet');
          }
      } else {
          $("#vpDonateButtonLabelDiv").append('');
      }
  });
  </code></pre>
  
  <p>However, it is not working. What did I miss here? or is my method wrong? Thanks a lot</p>