Skip to main content
added 12 characters in body
Source Link
Ganesh Sanap - MVP
  • 46.4k
  • 22
  • 31
  • 63

Here is what appears to have been happening. If you know of a better workaround or alternate explanation, let me know.

I was including the jQuery file and then my custom jQuery code in another file. All of my init was in my $(document).ready()$(document).ready() and it, among other things, started a polling process using setInterval()setInterval().

With no extra web parts on the page, it all worked great. When I added some types of web parts, the $(document).ready()$(document).ready() might or might not complete and the routine being called by setInterval()setInterval() might run once or twice. Made it hell to debug.

Apparently, one or more web parts were dynamically loading JavaScript that redefined $ to not be a synonym for jQuery, so the first few lines of my code would work, then the web part code would be loaded, then all of my $(...) functions would bomb out.

Changing my code from $("selector").whatever()$("selector").whatever() to jQuery("selector").whatever()jQuery("selector").whatever() fixed the problem as far as I can tell, but that was some fairly annoying an unpredictable behavior (or at least a Microsoft caveat that I overlooked somewhere).

Here is what appears to have been happening. If you know of a better workaround or alternate explanation, let me know.

I was including the jQuery file and then my custom jQuery code in another file. All of my init was in my $(document).ready() and it, among other things, started a polling process using setInterval().

With no extra web parts on the page, it all worked great. When I added some types of web parts, the $(document).ready() might or might not complete and the routine being called by setInterval() might run once or twice. Made it hell to debug.

Apparently, one or more web parts were dynamically loading JavaScript that redefined $ to not be a synonym for jQuery, so the first few lines of my code would work, then the web part code would be loaded, then all of my $(...) functions would bomb out.

Changing my code from $("selector").whatever() to jQuery("selector").whatever() fixed the problem as far as I can tell, but that was some fairly annoying an unpredictable behavior (or at least a Microsoft caveat that I overlooked somewhere).

Here is what appears to have been happening. If you know of a better workaround or alternate explanation, let me know.

I was including the jQuery file and then my custom jQuery code in another file. All of my init was in my $(document).ready() and it, among other things, started a polling process using setInterval().

With no extra web parts on the page, it all worked great. When I added some types of web parts, the $(document).ready() might or might not complete and the routine being called by setInterval() might run once or twice. Made it hell to debug.

Apparently, one or more web parts were dynamically loading JavaScript that redefined $ to not be a synonym for jQuery, so the first few lines of my code would work, then the web part code would be loaded, then all of my $(...) functions would bomb out.

Changing my code from $("selector").whatever() to jQuery("selector").whatever() fixed the problem as far as I can tell, but that was some fairly annoying an unpredictable behavior (or at least a Microsoft caveat that I overlooked somewhere).

Source Link

Here is what appears to have been happening. If you know of a better workaround or alternate explanation, let me know.

I was including the jQuery file and then my custom jQuery code in another file. All of my init was in my $(document).ready() and it, among other things, started a polling process using setInterval().

With no extra web parts on the page, it all worked great. When I added some types of web parts, the $(document).ready() might or might not complete and the routine being called by setInterval() might run once or twice. Made it hell to debug.

Apparently, one or more web parts were dynamically loading JavaScript that redefined $ to not be a synonym for jQuery, so the first few lines of my code would work, then the web part code would be loaded, then all of my $(...) functions would bomb out.

Changing my code from $("selector").whatever() to jQuery("selector").whatever() fixed the problem as far as I can tell, but that was some fairly annoying an unpredictable behavior (or at least a Microsoft caveat that I overlooked somewhere).