title: Add a parameter to a link using jQuery
body: <p>I am new to JavaScript/jQuery. I have the following HTML code that's automatically generated by framework. </p>
  
  <pre><code>&lt;tr class="alternate-row"&gt;
      &lt;td&gt;17 July, 2012&lt;/td&gt;
      &lt;td&gt;AM Shipment&lt;/td&gt;
      &lt;td&gt;Generated&lt;/td&gt;
      &lt;td&gt;
          &lt;form method="post" action="" id="ListTruckSheets_o_7" class="basic-form" onsubmit="javascript:submitFormDisableSubmits(this)" name="ListTruckSheets_o_7"&gt;//I have the name of this form.
              &lt;input type="hidden" name="shipmentId"  value="10310" id="ListTruckSheets_shipmentId_o_7"&gt;
              &lt;input type="hidden" name="Report" id="truckSheet_o_7" onclick="javascript:setSelectedRoute(this, 10310);"&gt;
              &lt;input type="hidden" name="abstractReport" id="routeAbstract_o_7" onclick="javascript:setSelectedRoute(this, 10310);"&gt;
              &lt;input type="hidden" name="milkDeliverySchedule" id="deliverySchedule_o_7"  onclick="javascript:setSelectedRoute(this, 10310);"&gt;
              &lt;input type="hidden" name="cancelShipment" id="ListTruckSheets_cancelShipment_o_7"&gt;
          &lt;/form&gt;
          &lt;td&gt;
              &lt;a class="buttontext" href="/myportal/control/KVGenerateTruckSheet.txt?shipmentId=10310&amp;amp;reportTypeFlag=trucksheet"  target="_blank" onclick="javascript:setSelectedRoute(this, 10310);" title="Report"&gt;Truck Sheet Report&lt;/a&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a class="buttontext" href="/myportal/control/KVGenerateTruckSheet.txt?shipmentId=10310&amp;amp;reportTypeFlag=abstract" target="_blank" onclick="javascript:setSelectedRoute(this, 10310);" title="Abstract Report"&gt;Route Abstract Report&lt;/a&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a class="buttontext" href="/myportal/control/MilkDeliveryScheduleReport.txt?hipmentId=10310&amp;amp;reportTypeFlag=milkDeliverySchedule" target="_blank" onclick="javascript:setSelectedRoute(this, 10310);" title="Milk Delivery Schedule"&gt;Delivery Schedule&lt;/a&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;form method="post" action="/myportal/control/cancelLMSShipment" target="_blank"    onsubmit="javascript:submitFormDisableSubmits(this)" name="ListTruckSheets_o_7_0_o_cancelShipment"&gt;
                  &lt;input name="shipmentId" value="10310" type="hidden"&gt;
              &lt;/form&gt;
              &lt;a class="buttontext" href="javascript:document.ListTruckSheets_o_7_0_o_cancelShipment.submit()"&gt;Cancel&lt;/a&gt;
          &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Using onclick I have called a JavaScript function which gets the url and add a parameter to it. I have the name or Id of the form('ListTruckSheets_o_7'). Using form name or Id I need to find the parent tr and identify the right td I want and set parameter to its url. This is the code I am currently messing with.</p>
  
  <pre><code>function setSelectedRoute(existingUrl, shipmentId) {
       var form = $("input[value=" + shipmentId + "]").parent(); //formName: ListTruckSheets_o_7
       var routeId = form.find("option:selected").text();
       var resultUrl = existingUrl + "&amp;facilityId=" + routeId;
       $('.buttontext').attr('href', resultUrl); // this is setting resultUrl to all the .buttontext class elements but I need to set resultUrl to only specific selected td.
  }
  </code></pre>
  
  <p>So, may be, I need to find the parent tr and get back to the specific td and set resultUrl to it. I have no idea how to do it. I hope I am clear with my question. </p>