Help understand, function(e) in Jquery
I want to learn abou开发者_开发知识库t the function(e)
, its functions, parameters and similar. Can you point me to some tutorials I can use
You should be more precise. It is mostly used as event object, but what it contains is strictly connected with event type. Take a look here: http://api.jquery.com/category/events/event-object/
To any event handler in jQuery, the first argument is the event object, normally called e
or event
, you can read more about it here: http://api.jquery.com/category/events/event-object/
The most common uses are using it for stop bubbling (e.stopPropagation()
), stopping the default event (e.preventDefault()
), or getting/using the target (e.target
)
, but there are lots of other uses as well.
It is an anonymous function that takes one named argument: e. (And, like any JS function, any number of unnamed arguments available through the arguments
array.
It does whatever it is written to do.
In most cases, e
suggests that it will be used as an event handler, so e
will be an event object.
精彩评论