MaTTP
MaTTP

Reputation: 953

Netbeans 7.3.1 autocomplete code on my Javascript Class doesn't work

I have a question about autocomplete code for Javascript on Netbeans 7.3.1 for Mac. I have the following javascript code tha defines a class "Person":

function Person(nm, cgn, ss){
                 this.nome = nm;
                 this.cognome = cgn;
                 this.sesso = ss;

                 this.getNome = function(){
                    return nome;
                 };
                 this.getCognome = function(){
                    return cognome;
                 };
                 this.getSesso = function(){
                    return sesso;
                 };
              }

Under this code, if i try to write the following code:

var aPerson = new Person("C", "A", "p");
aPerson.get

I don't see (in autocomplete box) any function related to Person object.

Thanks.

Upvotes: 1

Views: 1500

Answers (1)

Fry
Fry

Reputation: 6275

It's a limitation of NetBeans. Follow this step

  1. Create a new file .js : MyClass.js
  2. Insert class declaration in MyClass.js
  3. Back to the .html and import the file <script src = "MyClass.js">

Now you can use the object MyClass with autocompletion.

Upvotes: 1

Related Questions