Nitin Nitin - 3 months ago 8x
jQuery Question

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

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 know if adding an OR sign in the second case makes a difference?


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


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