-1

I have a function, look like this

$(".btn-vote").click(function(){
//bla bla
});
$(".btn-vote").dblclick(function(){
//bla bla
});

How can I compact it? Thanks everyone

0

1 Answer 1

2

Use jQuery .on() method :

$(".btn-vote").on('click dblclick',function(){
  //bla bla
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you so much

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.