Is a JavaScript function defined in Does this avoid the problem of not loading function show() in create.js? – tonga Feb 06 '13 at 21:04

  • That would also avoid the problem. Until the line where `create.js` is called, the needed function would have already been loaded. So yes, it would also work. However especially when you're making DOM changes, it's a must to have your scripts either after "document completed" sort of event catchers, or after your whole body content, before the tag is closed. – ASertacAkkaya Feb 07 '13 at 00:37
  • 1

    Yes, this is how add-in libraries like jQuery work. You include their .js file, and then call its methods.

    DOK
    • 32,337
    • 7
    • 60
    • 92
    • Thanks. But in this case, it is different because I want to refer a function in create.js where the function show() is defined below. – tonga Feb 06 '13 at 20:46
    • 1
      There tends to be more of an issue when javascript inadvertently references an HTML element that does not yet exist on the page. You might find [this excellent question and its answers](http://stackoverflow.com/questions/1795438/load-and-execution-sequence-of-a-web-page) helpful. – DOK Feb 06 '13 at 20:53