I am trying to do a similar action when submitting two different forms:
I am able to do this using :
$('#form1,#form2,').on('submit', function (e) {
e.preventDefault();
//Get action URL
serviceUrl = $(this).attr('action')
//Dome something
});
But is there a way to have multiple selectors when jQuery object is already declared?
var form1=$('#form1');
var form2=$('#form2');
$($form1,$form2).on('submit', function (e) {
e.preventDefault();
//Get action URL
serviceUrl = $(this).attr('action')
//Dome something
});
.add()method i.e.$form1.add($form2).on(....)