Rich-text Reply

multiple selectors in click event

Daltman314 11-22-16
Accepted Solution

multiple selectors in click event

I'm testing a new apply button on our homepage. There are 4 of them on our site. How can I make one click event for all of them? I don't want to create a click event for each one. We are only testing copy in the button.

CouchPsycho 11-22-16
 

Re: multiple selectors in click event

Hi,

just expand the selectors you use when attaching the click-function

 

$( "#button1, #button2, #button3, #button4" ).on( "click", function() {
alert("Can't touch this....");
});

Selectors must be comm-seperated.

 

Kind regards

 

Michael




"the essence of the creative act is to see the familiar as strange." (anonymous)