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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:00:58+00:00 2026-06-11T12:00:58+00:00

I have an input field with the the id id_email. A user will enter

  • 0

I have an input field with the the id “id_email”. A user will enter his email into this field on my form. I am trying to run some validation code on the email that the user inputs. I would like to pass the inputted value to the server to compare it to the database, but jQuery keeps returning a blank string.

HTML:

<div class="fieldWrapper">
                <label for="email">Email</label>
                <input type="text" placeholder="Email" id="id_email" name="email" maxlength="75">
           </div>

Javascript:

function CheckDuplicateEmail(invalidForm)
{
  $("#id_email").focusout(function()
  {
    $.ajax({ type: "POST",
             url: "/CheckDuplicateEmail/",
             dataType: "json",
             data: {"email" : $("#id_email").html()},
             success: function(jsonObject) 
             { 
                if (jsonObject === "exists")
                {
                    $("this").append("<ul class=\"errorlist\"><li>This email already exists<li></ul>")
                    invalidForm = true;
                }
                else
                {
                    invalidForm = false;
                }
             }
    });
  });
}

When I look at the AJAX post that is being sent to the server, I can see that email is blank. The line $(“#id_email”).html() is failing. I know that the selector is working correctly because the AJAX request is sent to the server. This implies that $(“#id_email”).focusout is working correctly. Since this statement uses the same selector as the $(“#id_email”).html() statement, I have to assume the html() function is wrong. Note that I tried the text() function with the same results.

Does anyone have any idea what is wrong?

  • 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-11T12:00:59+00:00Added an answer on June 11, 2026 at 12:00 pm

    Use $("#id_email").val()

    function CheckDuplicateEmail(invalidForm)
    {
      $("#id_email").focusout(function()
      {
        $.ajax({ type: "POST",
                 url: "/CheckDuplicateEmail/",
                 dataType: "json",
                 data: {"email" : $("#id_email").val()},
                 success: function(jsonObject) 
                 { 
                    if (jsonObject === "exists")
                    {
                        $("this").append("<ul class=\"errorlist\"><li>This email already exists<li></ul>")
                        invalidForm = true;
                    }
                    else
                    {
                        invalidForm = false;
                    }
                 }
        });
      });
    }
    

    You may check out this post to know more when to use getters like .html(), .val() and .text()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input field in a form. Upon pushing submit, I want to
i have an input field which will be displayed. i want that to hide
Say I have an HTML form like this to collect an email from a
I have a form created where user will select yes if they have something.
I have email field in user's settings area. All emails are unique, of course,
I have an input field with an id that is used as a button.
I have a input field with a name attribute like field[subkey][subkey2] How can I
I have one input field and one division with span children <input type=text id=input
I have an input field that is by default set to type=text so that
I have an input field which has a placeholder text. I want one word

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.