I am trying to change the form action in my jade file based on the button click, "Save" and "Delete".

```
form(method='post', id='updateForm')
        label Course Number
        input(type='text', name='courseNum', value= courses[0].courseNum)
        br
        label Course Name
        input(type='text', name='courseName', value= courses[0].courseName
        br
        button#btnSave(type='button') SAVE
        button#btnDelete(type='button') DELETE

script.
    $('#btnDelete').click(function(){
        var action = $(this).val() == '/course/delete/'+courses[0].courseId;
        $('#updateForm').attr('action', action);
        $('#updateForm').submit();
    });
    $('#btnSave').click(function(){
        var action = $(this).val() == '/course/update/' + courses[0].courseId;
        $('#updateForm').attr('action', action);
        $('#updateForm').submit();
    });

```

The input value (courses item) is passed correctly so I assume that in the script it is also passed correctly. But, why the form is not submitting? There are no actions shown.

Does my script is not correct? What is the best way to change form action?

Thanks.