Function serving two forms

I am looking for a way to have a function that can be accessed by two different forms (1 popup modal with a form and a form in the footer). The problem I see Is that I can not simply use something like form, because on other pages there are alse forms available which should not access this function (maybe I don’t describe it in a right way?) This is how I normally would call the function:

$("#newsletterForm").on("submit", function(e) {
......
$.ajax({ etc

Where in this example this form is the form in the footer. At the same time I would like to be able to call the same function from the form in the modal

I believe you could comma-separate your selectors like so $("#newsletterForm, #someotherform")...

Hope it helps

1 Like

@Andres_Vaquero. I didn’t know that was possible. That makes things quite easy. Thanks a lot for the reply and sollution.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.