I am trying to load a file.js dynamically with $.getScript. I have several select options to load different script on each click. I just want to call it once and if possible remove it from the dom on clicking another option, but firebug says loading the same script again and again on the next subsequent clicks. Having tried several solutions, but found unexpected results:
- placing unbind click, or event right in the callback. This one kills the click event on the next click. I still want the click to happen. Perhaps I did it wrong.
- using .length to check if the url is there to no luck
- using variables/ function in the script if it is there in the dom already
Did I miss anything, or is it supposed to be so? I found an eternal question on this matter in jquery forum alone :) Hope found better luck here. Thanks for kind help.