Is jQuery automatically disabling events when a window is unloaded

For example, on the page I have

$(document).ready(function()
{
    $('#some-element').click(function()
    {
       // do something..
    });
});

I also need to add unbind code - or will jQuery automatically do this for me?

$(window).unload(function()
{
    $('#some-element').unbind();
});
+3
source share
2 answers

If you ask about when the page is being refreshed (for example, the user clicks a link or something else), then that doesn't matter, since the page / client side code no longer exists at this point.

So, I would not worry about undoing something in this scenario.

+4
source

You do not need to do this.

+1
source

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


All Articles