Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between .on('click tap') and .on('click || tap')?

Tags:

jquery

What is the difference between

$('.classname').on('click tap', function(){});

and in the second case there is an OR sign ('||') between the events

$('.classname').on('click || tap', function(){});

Both seem to work fine but I would really like to know if adding an OR sign in the second case makes a difference?

like image 497
Nitin Avatar asked Jul 18 '16 16:07

Nitin


1 Answers

|| is not used as OR in jquery binding. It bind custom event named ||. Which can be triggered by:

$('.classname').trigger('||');

So, don't use it, if you don't need it.

like image 55
Bogdan Kuštan Avatar answered Jan 02 '23 18:01

Bogdan Kuštan