Nitin Nitin - 1 year ago 92
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?

Answer Source

|| 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download