What is the difference between function(){ and function(e){? All over the web, i have seen in lot of places like,
$('element').bind(function(){});
and
$('element').bind(function(e){});.
But can anyone differentiate this clearly? So that i can understand that.
The difference is event object being passed to event function. You can find details of event object here
$('element').bind(function(){})does not provide the event object in it.$('element').bind(function(e){})provides event object could be used to determine the source that caused event by e.target, and provides method like stopPropagation() etc.Live Demo
Here in live demo you wont be able to get the id of the td being click without event object.