jQuery click event but with multiple targets

jQuery click event but with multiple targets
0

#1

Is their a way in jQuery to say if i click button1 or button2 run this code?

Currently you do this for button clicks with jQurey:

$("#button1").click(function() {

}

But can i also add #button2 in their?


#2

Sure, just add the other selector separated by a comma like:

$("#button1, #button2").click(function() {
  
})