I have two buttons in a form and two different pages have to be called when they are clicked. when button1 is clicked then page1 must be loaded and when button2 is clicked t
To change action value of form dynamically, you can try below code:
below code is if you are opening some dailog box and inside that dailog box you have form and you want to change the action of it. I used Bootstrap dailog box and on opening of that dailog box I am assigning action value to the form.
$('#your-dailog-id').on('show.bs.modal', function (event) {
var link = $(event.relatedTarget);// Link that triggered the modal
var cURL= link.data('url');// Extract info from data-* attributes
$("#delUserform").attr("action", cURL);
});
If you are trying to change the form action on regular page, use below code
$("#yourElementId").change(function() {
var action = ;
$("#formId").attr("action", action);
});