1

I am getting this error "Uncaught ReferenceError: $ is not defined" please find my code below.

///<reference path="jquery.d.ts" />

class Test {
    name: string;

    constructor() {
        this.name = "gowtham";
    }

    dispname() {
        alert("Name :" + this.name);
    }
}

$(document).ready(function () {

    debugger;
    var test = new Test();
    $('#test').on('click', function() {
        debugger;
        test.dispname();
    });

});

i am having the referance too reference path="jquery.d.ts" in my .ts file. Am i missing anything here .?

Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
Gowthaman
  • 790
  • 1
  • 10
  • 29

1 Answers1

3

You're getting a runtime error because you haven't loaded JQuery properly, if the issue was with the typings then you would've seen a compiler error.

See existing question: Uncaught ReferenceError: $ is not defined?

Community
  • 1
  • 1
Vadim Macagon
  • 14,463
  • 2
  • 52
  • 45