4

I am using this tutorial to try to load jquery into my SPF project. http://dev.office.com/sharepoint/docs/spfx/web-parts/basics/add-an-external-library

I followed strictly

tsd install jquery --save

Update the config.json in the config folder to load jQuery from CDN. Add an entry to the externals field:

"jquery": "https://code.jquery.com/jquery-3.1.0.min.js"

Import jQuery in your web part:

import * as $ from 'jquery';

However I keep getting this errors

Warning - tslint - src/webparts/helloWorld/HelloWorldWebPart.ts(12,13): error no-unused-variable: Unused import: '$'
Error - typescript - src/webparts/helloWorld/HelloWorldWebPart.ts(12,20): error TS2307: Cannot find module 'jquery'.
Error - 'typescript' sub task errored after 3.97 s 
0

Try using npm to install the typings:

npm install --save @types/jquery

Source: Add jQueryUI Accordion to your SharePoint client-side web part

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.