From this tutorial, it is said:
preventDefault();
does one thing: It stops the browsers default behaviour.
I searched online for the examples of preventDefault()
, I can only see in two situations (link, form) we use preventDefault()
: Prevent a submit button from submitting a form and prevent a link from following the URL.
So, my question is:
In what other situations can we use
preventDefault()
?How could I find out all the browsers default behaviour? e.g. if I click a button, what is the browsers default behaviour?