Uncaught ReferenceError: myFunction is not defined
<p>Gives an error. I have placed the code just before <code>&lt;/body&gt;</code>. Still getting the error.</p>

<pre><code>&lt;form action="" method="get" id="searchform" &gt;
&lt;input name="q" type="text" id="search" size="32" maxlength="128" class="txt"&gt;
&lt;input type="button" id="hit" value="Search" onclick="myFunction();return false" class="btn"&gt;   
&lt;/form&gt;
</code></pre>

<p>JS,</p>

<pre><code>&lt;script type="text/javascript"&gt;
    var nexturl = "";
    var lastid = "";
    var param;
    $(document).ready(function () {
        function myFunction() {
            param = $('#search').val();
            alert("I am an alert box!");
            if (param != "") {
                $("#status").show();
                var u = 'https://graph.facebook.com/search/?callback=&amp;limit=100&amp;q=' + param;
                getResults(u);
            }
        }
        $("#more").click(function () {
            $("#status").show();
            $("#more").hide();
            pageTracker._trackPageview('/?q=/more');
            var u = nexturl;
            getResults(u);
        });
    });
&lt;/script&gt;
</code></pre>
