I am trying to load a .js file dynamically using $ .getScript. I have several choices for loading a different script for each click. I just want to call it once and, if possible, remove it from dom when I click another option, but firebug says it loads the same script again and again on the next subsequent clicks. After trying a few solutions, but finding unexpected results:
- placing a callback or event in a callback. This person kills the click event on the next click. I still want the click to occur. Perhaps I did it wrong.
- using .length to check if a url is needed.
- using variables / function in script if it is already in dom already
Am I missing something, or should it be like that? I found the eternal question on this issue only in the jQuery forum :) I hope that it is more fortunate here. Thanks for the kind help.
source share