0

Ok, noob question here and I'm sure its been answered somewhere, but I can't seem to find it.

I inherited an app to update and the previous coder had an anonymous function which and '(jQuery)' is just stuck on the end. It's giving me an error and nothing seems to change when I comment it out. What is it supposed to do? I'm using VS 2019 and I don't see anything which defines it.

Here is a brief code sample:

(function($){ pretty much vanilla code here... })(jQuery)

thanks!

  • Thanks VLAZ, I was just finding something similar on learn.jquery.com but I'm having trouble understanding why the error would say the 'jquery isn't defined'. Any ideas? – Brian Tremelling Nov 02 '20 at 21:56
  • https://stackoverflow.com/questions/2194992/jquery-is-not-defined - most likely you haven't added it to the page. – VLAZ Nov 02 '20 at 21:57
  • No, its certainly in there. I'm using it everywhere and is loaded in my _Layout.cshtml page. hmmmm.... – Brian Tremelling Nov 02 '20 at 22:01
  • Are you trying to use it *before* it's included? – VLAZ Nov 02 '20 at 22:02
  • Yes! Yeah, should have caught that myself. I had re-arranged my links to avoid the jQuery / Bootstrap / jQuery-ui conflicts and I can see the error now. Thanks!! – Brian Tremelling Nov 02 '20 at 22:05

0 Answers0