Pregunta

When I write the following code, whether Im using Aptana, Dreamweaver or Eclipse, I can never see functions in the onready block in the outline view:

$(document).ready(function(){
   function myFunction(){
   }
   function myFunction2(){
   }
});

Basically the only thing I see in outline is the onready and I have to remove the onready if I want to see all my functions. What technique or way of handling this situation can I try to both see all the functions in outline view and still use onready?

¿Fue útil?

Solución

What technique or way of handling this situation can I try to both see all the functions in outline view and still use onready?

Just don't define your own functions inside like you demostrated. It's unnecessary. Have your functions defined outside like so:

function myFunction(){

}

function myFunction2(){

}

$(document).ready(function() {
    myFunction();
    myFunction2();    

});

Otros consejos

A simpler way to do the onready is:

$(function(){
 ... code here ...
})

Maybe this will solve your problem...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top