I would like to know if (and how) it is possible to stop the jQuery script on a click event.
I load it on a click like this
$("#id_button").click(function() { $.getScript("script.js"); alert ("The script is activated"); });
And I would like to stop him in the same way.
I'm not sure if you are idle for this or not.
You can bind and untie the event using jquery, for example
$("#id_button").bind("click", function(){ });
and for unbind
$("#id_button").unbind("click");
If it concerns the dynamic "unloading" of the js file, you can apply the Jonathan Sampson method .
In principle, "script.js" can be encapsulated in an object and "click" dynamically loaded. In the next click event, by pressing any button or event of your choice, you can set this object to null by deleting these script features.
Edit: Rebecca Murphy code show slideshow.
Source: https://habr.com/ru/post/1313603/More articles:User Targeting Algorithm - designmethod to call a class (with constructors) without creating an object in php - instantiationC ++ Template Specialization for Template Types - c ++the inability to create a DirectX device and swapchain - c ++The best random โfeelโ of an integer generator for short sequences - algorithmGame engine threading model - c ++Computing complex numbers with rational exponents - javamodal window not modal in chrome - javascriptHow to create a delegate for a reflected method at runtime - reflectionIntroducing the TortoiseSVN / TortoiseGit icons in 32-bit applications on 64-bit Windows - windowsAll Articles