What is the argument?

$(document).ready(function(){
  $('#something ul a').click(function(e) {
   ...
   ...
    e.preventDefault();
  })
});

what is e for and e.preventDefault, so I can understand what is going on here.

+3
source share
5 answers

The argument eis an eventobject .
It contains information about the click event.

See the documentation for more information .


preventDefault()The method prevents the default action for the default server for borwser.
In this case, the browser will not be able to go to the link.

+5
source

This prevents the default action for the event, for example. transition to the URL-address or scroll the page up #locationinto href.

jQuery .

+2

e , .

+1

E - preventDefaults . , , preventDefaults, .

+1

preventDefault() borwser. . shareedit

0

Source: https://habr.com/ru/post/1764516/


All Articles