Adding jQuery and jQueryUI to your TypeScript project

Installing jQuery

jQuery is already installed within the Aurelia skeleton project (link). For example, we can download a fresh copy of ‘skeleton-typescript’ and add the following method to the welcome.ts file:

attached(){
  alert($('#fn').val());
}

When you load the welcome page it will display an alert showing the value in the First Name input field. This works out of the box.

There is a small problem though. In your editor the .val() function will have a red squiggle under it b/c you haven’t loaded the TypeScript definition file yet. Your editor, assuming it’s a TS aware editor like Visual Studio Code, doesn’t recognize the .val() function and gives you an error. So we need to add the .d.ts file to our project:

Read more