Calling External function from within function - Javascript <p>I am using Phonegap and JQueryMobile to create a web application. I'm new to javascript and am having an issue.</p> <p>My issue is with calling a function I have in a file named "testscript.js", the function is called testFunc. The testscript.js containts only this:</p> <pre><code>function testFunc() { console.log("Yes I work"); } </code></pre> <p>Within my html page I have the following code:</p> <pre><code>&lt;script&gt; $('#pageListener').live('pageinit', function(event) { testFunc(); }); &lt;/script&gt; </code></pre> <p>The test function is found within my "testscript.js" which I am including with this line within the head tags:</p> <pre><code>&lt;script src="testscript.js"&gt;&lt;/script&gt; </code></pre> <p>The error I get is a "testFunc is not defined".</p> <p>I am assuming its some type of scope issue as I'm able to call other jquery functions such as:</p> <pre><code>alert("I work"); </code></pre> <p>and I am able to call my functions by sticking them within script tags in the html elsewhere.</p> <p>I've tried all sorts of ways of calling my function with no success, any help is appreciated!</p>