开发者

What is the argument for?

开发者_如何学Go
$(document).ready(function(){
  $('#something ul a').click(function(e) {
   ...
   ...
    e.preventDefault();
  })
});

what is the e for and the e.preventDefault mean so i can understand what is happening here


The e argument is the event object.
It contains information about the click event.

For more information, see the documentation.


The preventDefault() method prevents the borwser's default action for the event.
In this case, it will prevent the browser from navigating to the link.


It's preventing the default action of the event, e.g. going to the URL, or scrolling the page to the #location in the href.

The first argument to any event handler in jQuery is the event object itself.


e is the event object, and prevent default is one of its functions.


E is event and preventDefaults prevents browser from performing a standard operation in response to such an event. For instance if this is a click event on a link, preventDefaults whould prevent browser from redirecting to a linked page.


The preventDefault() method prevents the borwser's default action for the event. In this case, it will prevent the browser from navigating to the link. shareedit

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜