title: Jquery to change a form's target
body: <p>I want to change the form's target based on the option which is selected. </p>
  
  <pre><code>&lt;form id='post_form' target="targetvalue"&gt;
  
  &lt;select id="select" name="select"&gt;
  &lt;option value="option1"&gt;Option 1&lt;/option&gt;
  &lt;option value="option2"&gt;Option 2&lt;/option&gt;
  &lt;/select&gt;
  
      &lt;/form&gt;
  
  
   &lt;script&gt;
   $("#select").change(function() {
      var targetvalue = $("#select option:selected").text();
      $("#post_form").attr("target", targetvalue);
      });
  
   &lt;/script&gt;
  </code></pre>