title: how to let a submit button in a form do something before executing the action of the form
body: <p>Good evening, i have a HTML form that contains a submit button that does something other than executing the action of the form, i want these submit button to do an action first then do the  action of the form, that button do a nice jquery slideUp() but when i embed it in a form it does the action of the form and neglect the slideUp() behavior, what are the possible ways to let that button do the slideUp() first before submitting the form?</p>
  
  <p>here's the form:</p>
  
  <pre><code>    &lt;form action="AddNewCar" method="get"&gt;
              &lt;table BORDER=2 BORDERCOLOR=YELLOW width="300px"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Description: &lt;input type="text" name="desc" /&gt;&lt;/td&gt;
                      &lt;td&gt;Quantity:&lt;input type="text" name="qunt" /&gt;&lt;/td&gt;
                      &lt;td&gt;Price: &lt;input type="text" name="price" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  
                  &lt;tr&gt;
                      &lt;td&gt;CC.No: &lt;input type="text" name="cc" /&gt;&lt;/td&gt;
                      &lt;td&gt;Engine: &lt;input type="text" name="engine" /&gt;&lt;/td&gt;
                      &lt;td&gt;Cylinder.No: &lt;input type="text" name="cylinder" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  
                  &lt;tr&gt;
                      &lt;td&gt;Max-speed: &lt;input type="text" name="speed" /&gt;&lt;/td&gt;
                      &lt;td&gt;Petrol-type: &lt;input type="text" name="ptr-type" /&gt;&lt;/td&gt;
                      &lt;td&gt;Petrol-capacity: &lt;input type="text" name="ptr-cpcty" /&gt;&lt;/td&gt;
  
                  &lt;/tr&gt;
                  &lt;tr&gt;
  
                      &lt;td colspan="3"&gt;&lt;input type="submit" class="btn1" value="Add" onclick="addNewCar()" /&gt;&lt;/td&gt;
  
                  &lt;/tr&gt;
              &lt;/table&gt;
  
  
  
  
          &lt;/form&gt;
  </code></pre>
  
  <p>and here's the script is supposed to execute before anything else:</p>
  
  <pre><code>&lt;script type="text/javascript" src="jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>$(".btn1").click(function() {
          $('#toggleText').slideUp();
      });
  
  
  
  &lt;/SCRIPT&gt;
  </code></pre>