Trigger a specific input button in a form from another forms input buttons
<p>I want to trigger a specific input button in a form from another forms input buttons. As if someone clicked on that button not just submit the form as in the answer in this thread. This is the one  I want triggered.</p>

<pre><code>&lt;td width="135" align="right"&gt;&lt;input border="0" type="image" id="btnRecalculate" name="btnRecalculate" src="v/vspfiles/templates/100/images/buttons/btn_recalculate.gif" alt="Recalculate Totals"&gt;&lt;/td&gt;
</code></pre>

<p><a href="http://stackoverflow.com/questions/3291021/check-textboxes-for-change-in-value-from-default-value-when-page-loaded">previous question</a></p>

<pre><code>&lt;form method="POST" name="form" action="ShoppingCart.asp" onsubmit="if (typeof(Update_Hidden_State_Fields)=='function') Update_Hidden_State_Fields(); if (this.submitted) return false; else {this.submitted=true; return true;}"&gt;   &lt;td&gt;&lt;center&gt;&lt;input type="text" maxlength="7" size="5" value="5" name="Quantity1" id="Quantity1"&gt;&lt;center&gt;&lt;/td&gt;
&lt;td&gt;&lt;center&gt;&lt;input type="text" maxlength="7" size="5" value="2" name="Quantity2" id="Quantity2"&gt;&lt;center&gt;&lt;/td&gt; 
&lt;td&gt;&lt;center&gt;&lt;input type="text" maxlength="7" size="5" value="5" name="Quantity3" id="Quantity3"&gt;&lt;center&gt;&lt;/td&gt;
&lt;td width="135" align="right"&gt;&lt;input border="0" type="image" id="btnRecalculate" name="btnRecalculate" src="v/vspfiles/templates/100/images/buttons/btn_recalculate.gif" alt="Recalculate Totals"&gt;&lt;/td&gt;&lt;/form&gt;
</code></pre>

<p>this is the second form</p>

<pre><code>&lt;form name="Proceed_To_Checkout_Form" method="post" action="https://www.dothisurl.com/login.asp"&gt;
&lt;td&gt;&lt;input type="image" src="v/vspfiles/templates/100/images/buttons/btn_checkout_guest.gif" name="btn_checkout_guest"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="image" src="v/vspfiles/templates/100/images/buttons/btn_checkout_guest.gif" name="btn_checkout_guest"&gt;&lt;/td&gt;&lt;/form&gt;
</code></pre>

<p>This is the previous answer given</p>

<pre><code>$(function(){
$("[id^='Quantity']").each(function(){
$(this).data('default', $(this).val());
});

$("[name='Proceed_To_Checkout_Form']").submit(function(){
var hasChanged = false;
$("[id^='Quantity']").each(function(){
  if($(this).val() != $(this).data('default')){
    hasChanged = true;
  }
});
if(hasChanged){
  $("[name='form']").submit();
  return false;
}
});
});
</code></pre>
