title: jQuery: Change "action" based on Select value
body: <p>I've made this code which changes the second select based on what you select in the first select.</p>
  
  <p>But now I need a way in jQuery to also change the "form action" based on what is selected on the first select. </p>
  
  <p>I want <code>action="renault.php"</code> if option 1 is selected and I want <code>action="citroen.php"</code> if option 2 is selected on the first select.</p>
  
  <p>I also want to be required both selects, so its mandatory to select at least one option on each select, and if someone doesnt do that and hit submit then an alert should tell them "please select at least one brand and one model"</p>
  
  <p>I've tried several codes but couldnt get this to work.</p>
  
  <p>Also if the person selects "select a model" or "select a brand" the alert should also appear (requesting to select at least one model and brand)</p>
  
  <p>Can someone help here?</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;form id="frmPreselect" name="frmPreselect" method="post" action=""&gt;
  
      &lt;p&gt;
      &lt;select name="selectOne" id="selectOne" style="font-size:16px; margin-right:20px;     font-family:Verdana, Geneva, sans-serif;"&gt;
        &lt;option value=""&gt;-- select a Brand --&lt;/option&gt;
  &lt;option value="1"&gt;Renault&lt;/option&gt;
  &lt;option value="2"&gt;Cïtroen&lt;/option&gt;
  &lt;/select&gt;
  
  
  &lt;select name="selectTwo" id="selectTwo" style="font-size:16px; font-family:Verdana, Geneva, sans-serif;"&gt;
  &lt;option value=""&gt;-- select a model --&lt;/option&gt;
  &lt;/select&gt;
    &lt;/p&gt;
    &lt;p&gt;
   &lt;input type="submit" value="SOLICITAR PRESUPUESTOS" style="font-size:20px; font-    family:Verdana, Geneva, sans-serif; font-weight:bold" /&gt;
    &lt;/p&gt;
  &lt;/form&gt;
  &lt;script type="text/javascript"&gt;
  $('#selectOne').change(function() {
  var options = '';
  if($(this).val() == '1') {
  options = '&lt;option value="clio"&gt;clio&lt;/option&gt;&lt;option value="symbol"&gt;symbol&lt;/option&gt;        &lt;option value="sandero"&gt;sandero&lt;/option&gt;';
  }
  else if ($(this).val() == '2'){
  options = '&lt;option value="Berlingo"&gt;Berlingo&lt;/option&gt;&lt;option value="C3"&gt;C3&lt;/option&gt;    &lt;option value="C4"&gt;C4&lt;/option&gt;';
  }
  $('#selectTwo').html(options);
  
  });
  &lt;/script&gt;
  </code></pre>