I have the following code for my webpage. It's pure basic but it doesn't do what I want somehow.

What is should do is, it should change the action target depending on the radio button selection. It doesn't even run the function. Could you please guide me what I am doing wrong?

Thanks.

You may find the same code: http://pastebin.com/5jjGQQkA

Code:
form id="choose_dept" method="POST" action="http://mywebsite.com/">

  

  <script type="text/javascript">
    <!--


$("#choose_dept").change(function(){

  $("#choose_dept").attr('action', 'http://mywebsite.com/' + $('input[name=section]:checked').val() + '/' );

  this.submit();
});
      -->
  </script>
  <div>
    
    <table>
      <tbody>
        <tr>
          <td>
            <input id="section_1" type="radio" name="section" value="tr1">
          </td>
          <td>
            <input id="section_2" type="radio" name="section" value="tr2">
          </td>
          <td>
            <input id="section_3" type="radio" name="section" value="tr3">
          </td>
        </tr>        
      </tbody>
    </table>
  </div>
</form>