title: Get action of form on change of select box using jQuery/JavaScript
body: <p>I have multiple forms on web page. I want form action of which select box is changed. All the form are same except hidden fields. There are no class or id to form. Below is the code structure.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function sortFunction(){
     var action = $(this).closest('form').attr('action');
     alert(action);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;form method="GET" name="FORM_TYPESH" action="xyz"&gt;
     &lt;select name="nShip" onchange="sortFunction()"&gt;
       &lt;option value="Any"&gt;Select Ship:&lt;/option&gt;
       &lt;option value="Any"&gt;Any&lt;/option&gt;
     &lt;/select&gt;
  &lt;/form&gt;
  &lt;form method="GET" name="FORM_TYPESH" action="abc"&gt;
     &lt;select name="nShip" onchange="sortFunction()"&gt;
        &lt;option value="Any"&gt;Select Ship:&lt;/option&gt;
        &lt;option value="Any"&gt;Any&lt;/option&gt;
     &lt;/select&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>