user961627
user961627

Reputation: 12747

Adding same click event handler to 2 different elements

I have to elements #addimage and #addimage_imgtab that both need to be handled by the same function when clicked. I thought the following code should work, but it isn't, what am I doing wrong?

$('#addimage #addimage_imgtab').click(function(e){ .... });

Upvotes: 0

Views: 134

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

You forget a comma:

$('#addimage, #addimage_imgtab').click(function(e){ .... });

Upvotes: 2

Related Questions