Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7976977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:03:37+00:00 2026-06-04T09:03:37+00:00

I have a really weird and confusing error. Here is my code: {if="$pjax ===

  • 0

I have a really weird and confusing error.

Here is my code:

{if="$pjax === false"}{include="header"}{/if}
<script type="text/javascript">
    $(document).ready(function() {
        function clickclear(thisfield, defaulttext) {
            if (thisfield.value == defaulttext) {
                thisfield.value = "";
            }
        }
        function clickrecall(thisfield, defaulttext) {
            if (thisfield.value == "") {
                thisfield.value = defaulttext;
            }
        }
    });
</script>
<form action='./login' method='post' name='form'>
<ul class="form">
    <li><input type="text" name="username" value="Username" id="username" onclick="clickclear(this, 'Username')" onblur="clickrecall(this,'Username')"  /></li>
    <li><input type="password" name="password" value="Password" id="password" onclick="clickclear(this, 'Password')" onblur="clickrecall(this,'Password')" /></li>
    <li><span style='display:block;height:27px;float:left;line-height:27px;'>Remember Me</span> <div id='itoggle' style='float:right;'><input type="checkbox" id="remember" class='itoggle' /></div><div class='clearfix'></div></li>
</ul>
</form>
<a href="javascript: form.submit()" class="button white">Login</a>
{if="$pjax === false"}{include="footer"}{/if}

You can see there are two functions, clickclear and clickrecall. These get called from the form inputs on onClick and onBlur. However, when I run them, I get these javascript errors:

Uncaught ReferenceError: clickclear is not defined

Uncaught ReferenceError: clickrecall is not defined

Any ideas? I know it’s probably something really simple, but I can’t see it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:03:39+00:00Added an answer on June 4, 2026 at 9:03 am

    It’s because your functions are in the .ready() callback. These are not visible from the global scope (which is good).

    It’s better using jQuery’s event attachment methods like .on():

    $(document).ready(function(){
    
        //your code
        function clickclear(){...}
        function clickrecall(){...}
    
        //the handlers
        $('#username').on('click',function(){ //bind click handler
            clickclear(this,'Username');      //things to do on click
        }).on('blur',function(){              //chain blur handler
            clickrecall(this,'Username');     //things to do on blur
        });
    
        $('#password').on('click',function(){ //bind click handler
            clickclear(this,'Password');      //things to do on click
        }).on('blur',function(){              //chain blur handler
            clickrecall(this,'Password');     //things to do on blur
        });
    
        ...other handlers...
    
    });
    

    And a side note, there is a placeholder attribute for Chrome, which acts like placeholder text:

    <input type="text" placeholder="username" />
    <input type="password" placeholder="password" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really weird problem with fgets() in C. Below is the code
IDE = VS7 or 2002 Hi all, I have a really weird problem here.
I'm battling a really weird problem here. I have a Windows 2008 R2 server
this seems to be weird but it really happened. I have this code working
I have a really weird problem. The below code works fine if I create
I have a really weird problem with /bin/bash and a script that uses printf
This is really weird and can't seem to understand it. I have a header
Have a really weird one here. The app has two targets, just to be
I have this really weird problem in my code (.Net Framework 3.5). So, in
I have a really weird problem with Xcode 3.2.5 In a normal code sequence

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.