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

What's the difference between

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

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

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

Both seem to work fine, but I would really like to know if adding the OR sign in the second case matters.

+6
source share
2 answers

|| not used as OR in jquery binding. It associates a custom event with the name || . Which may be caused by:

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

So, do not use it if you do not need it.

+6
source

"event || event" will not work. However, you can bind events to an "event event" or even specify .bind () rather than .on ()

-one
source

All Articles