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 .?

2
  • can you update your code to include the reference as well? are you sure that it's in the right path? Commented Feb 5, 2016 at 15:02
  • never mind, it's there, I edited the question with code formatting. still, are you sure the d.ts file is in the same path? Commented Feb 5, 2016 at 15:03

1 Answer 1

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?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.