title: Javascript - Function not found?! called from onClick, and function is in same page
body: <p>I have a really weird and confusing error.</p>
  <p>Here is my code:</p>
  <pre><code>{if=&quot;$pjax === false&quot;}{include=&quot;header&quot;}{/if}
  &lt;script type=&quot;text/javascript&quot;&gt;
      $(document).ready(function() {
          function clickclear(thisfield, defaulttext) {
              if (thisfield.value == defaulttext) {
                  thisfield.value = &quot;&quot;;
              }
          }
          function clickrecall(thisfield, defaulttext) {
              if (thisfield.value == &quot;&quot;) {
                  thisfield.value = defaulttext;
              }
          }
      });
  &lt;/script&gt;
  &lt;form action='./login' method='post' name='form'&gt;
  &lt;ul class=&quot;form&quot;&gt;
      &lt;li&gt;&lt;input type=&quot;text&quot; name=&quot;username&quot; value=&quot;Username&quot; id=&quot;username&quot; onclick=&quot;clickclear(this, 'Username')&quot; onblur=&quot;clickrecall(this,'Username')&quot;  /&gt;&lt;/li&gt;
      &lt;li&gt;&lt;input type=&quot;password&quot; name=&quot;password&quot; value=&quot;Password&quot; id=&quot;password&quot; onclick=&quot;clickclear(this, 'Password')&quot; onblur=&quot;clickrecall(this,'Password')&quot; /&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span style='display:block;height:27px;float:left;line-height:27px;'&gt;Remember Me&lt;/span&gt; &lt;div id='itoggle' style='float:right;'&gt;&lt;input type=&quot;checkbox&quot; id=&quot;remember&quot; class='itoggle' /&gt;&lt;/div&gt;&lt;div class='clearfix'&gt;&lt;/div&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/form&gt;
  &lt;a href=&quot;javascript: form.submit()&quot; class=&quot;button white&quot;&gt;Login&lt;/a&gt;
  {if=&quot;$pjax === false&quot;}{include=&quot;footer&quot;}{/if}
  </code></pre>
  <p>You can see there are two functions, <code>clickclear</code> and <code>clickrecall</code>. These get called from the form inputs on <code>onClick</code> and <code>onBlur</code>. However, when I run them, I get these javascript errors:</p>
  <blockquote>
  <p>Uncaught ReferenceError: clickclear is not defined</p>
  <p>Uncaught ReferenceError: clickrecall is not defined</p>
  </blockquote>
  <p>Any ideas? I know it's probably something really simple, but I can't see it.</p>