How to get jQuery intellisense in Visual Studio 2019

孤人 提交于 2021-01-26 11:48:51

问题


I am trying to get jQuery intellisense working in Visual Studio.

I am using the latest jQuery version jquery-3.3.1.js and latest Bootstrap v4.3.1. I have tried every solution on Stack Overflow but nothing has yet worked for me.

I tried to reference jquery-3.3.1.intellisense.js but nothing happened. I also tried installing jQuery typed script and then adding jsconfig.json and referencing the jQuery typed script in it but unfortunately again nothing happened.

To be clear, I expect intellisense to work when I type $.


回答1:


This is what worked for me:

  1. Added a Scripts folder to my solution,

  2. Added a file '_references.js',

  3. Added my reference statements to jQuery (I should upgrade jQuery, huh) in there:

    ///<reference path="jquery-1.10.2.js" />
    ///<reference path="jquery-1.10.2.intellisense.js" />
    
  4. Closed/Re-opened my solution and presto:

Here is some back story: https://www.madskristensen.net/blog/the-story-behind-_referencesjs/



来源:https://stackoverflow.com/questions/55704795/how-to-get-jquery-intellisense-in-visual-studio-2019

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!