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 8078703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:52:48+00:00 2026-06-05T15:52:48+00:00

Currently, I’m adapting a registration page to use Ajax/jQuery. Its in the simple stage,

  • 0

Currently, I’m adapting a registration page to use Ajax/jQuery. Its in the simple stage, asking simply for a username and password.

I want to use jQuery to tell the user if the current entry in the username textbox is invalid or has already been taken. If either conditional is met, the div namemsg will have text added to it and execute the fadeIn event.

The page loads with he submit button disabled, and upon passing validation the button is enabled. To do this, I have the following ajax request to handle the username validation

$("#username").keyup(function(){
    //get current value
    thisVal = $(this).val();

    //execute request to see if current val exists in database
    $.ajax({
      type: "GET",
      url: "includes/phpscripts.php?action=checkUser",
      data: {username:thisVal},
      success: function(data){

        //if username is already taken, show warning and disable submit button
        if (data == 'true'){
          $("#namemsg").text("Username is already taken");
          $("#namemsg").fadeIn(100);
          $("#submit").attr('disabled', 'disabled');
        } 

        //otherwise, possible valid username
        else if (data == 'false'){

          //check if username is of the proper length.  If not, display
          //error and disable submit button
          if ($(this).val().length < 5){
            $("#namemsg").text("Invalid Username");
            $("#namemsg").fadeIn(100);
            $("#submit").attr('disabled', 'disabled');
          } 


          //valid username, enable submit button and hide any error messages
          else {
            $("#namemsg").hide();
            $("#submit").removeAttr("disabled");
          }

        }
      }

    });

    return false;
});

My issue is that the request gets the propper value from the server, but firebug complains that elem.nodeName is undefined at line 2368 of jquery 1.7.2. That line is

if ( elem ) {
  hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];

When I set the breakpoint at if (elem), elem had the values

nodeName : INPUT
type : text

and hooks returned undefined. Is this a Firefox specific issue, an issue with my code or jQuery? Also, Is there a workaround for this?

  • 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-05T15:52:51+00:00Added an answer on June 5, 2026 at 3:52 pm

    Inside your success handler, this is the jqXHR request, not the $("#username") field, so $(this).val() is erroring.

    As you’ve got the value cached, it’d be best to use thisVal instead of $(this).val(), but in general the way to fix this is to set the context option to the element;

    $.ajax({
        context: this,
        type: 'GET',
        // etc
    });
    

    You can see the docs for this method on the jQuery.ajax() page (search for “context”).

    And another way you’ll see is to set the this that pointed to the element to another variable;

    $("#username").keyup(function(){
        var that = this;
    
        $.ajax({
          type: "GET",
          url: "includes/phpscripts.php?action=checkUser",
          data: {username:thisVal},
          success: function(data){
              // use `that` and `$(that)` in here
          }    
        });
    
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am trying to use a bunch of custom perl modules, test.pm as
Currently after my form has passed validation it forwards to an html page. I
Currently if i have dependency project opened, then maven use it instead of specified
Currently we use log4net of version 1.2.10.0 and we should start using some 3rd
I want use html5's new tag to play a wav file (currently only supported
currently I am trying to replace a simple HTML element to alert the user
Currently we use FogBugz for tracking issues and found it to be ok. I'm
Currently i am working simple PayPal integration in Android, So i set the Manifest.xml
Currently, Django 1.2.3 User model unicode is def __unicode__(self): return self.username and I'd like
Currently in my Terminal, every shell prompt looks like ComputerName: FooDir UserName$ . The

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.