Select to view content in your preferred language

jquery $ is undefined

3489
3
04-08-2016 02:11 PM
LoriEmerson_McCormack
Occasional Contributor

I used the LayerList widget and got it to work.  Then, I tried adding jquery code with a slide toggle so that the LayerList could be displayed and then hidden so that more of the map was visible.  However, I am getting an error when I try to view my html saying that the "$ is undefined" in my $(document).ready() statement.  My html is attached.

0 Kudos
3 Replies
LoriEmerson_McCormack
Occasional Contributor

I made a rookie mistake.  The link href= and the script src= were not listed as a URL, but instead were referencing folders within a specific Visual Studio solution.

0 Kudos
ChrisSmith7
Frequent Contributor

Instead of hosting jQuery, you can reference the CDNs:

jQuery CDN

This has the added benefit that it'll increase the likelihood of your visitors already having a cached instance of jQuery. It may not make a difference in your case, though. It can be quite noticeable in scale, however.

0 Kudos
LoriEmerson_McCormack
Occasional Contributor

Chris,

Thank you so much for your wisdom.  I will indeed use your advice.

0 Kudos