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

  • Home
  • SEARCH
  • 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 9113199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:54:42+00:00 2026-06-17T03:54:42+00:00

I feel like I’m missing something small, but I can’t seem to make this

  • 0

I feel like I’m missing something small, but I can’t seem to make this work. I am validating a form where a user is allowed to change their email, and among other things want to confirm that they have not re-entered the same email that they already have.

I’ve played around a lot trying to pull the value of the p with id=”originalemail”, but I can’t seem to get it in a form that, when compared to the value entered, reflects that the strings are identical. Any help would be hugely appreciated.

For the sake of simplicity, I’ve trimmed the function to only validate based on whether or not the entered new email matches the currently existing (original) email:

JS/jquery:

<script>
function validateEmailChange()
{
    // set comparison
    var originalemail=document.getElementById("originalemail").innerHTML;
    var newemail=document.forms["emailform"]["emailnewemail"].value;

    if (newemail == originalemail)
    {
        $('#emailnewemailoff').html("Same as current email address");
        $('#emailconfirmationoff').html("");
        return false;
    }
</script>

HTML:

// show the user's current email
<p id="originalemail"><?= htmlspecialchars($user[0]["email"]) ?></p>

<form id="emailform" name="emailform" onsubmit="return validateEmailChange()" 
              action="email.php" method="post">

<input id="emailnewemail" name="emailnewemail" placeholder="New Email" type="text"/>
<input type="submit" value="Change Email" class="btn"/>

Thanks so much!

  • 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-17T03:54:43+00:00Added an answer on June 17, 2026 at 3:54 am

    I created jQuery that evaluates when the user moves off the email input field ($('#emailnewemail').blur(), and it compares the values case-insensitive (.toLowerCase()) too, so that ‘my@email.com’ is recognized to be the same as ‘my@EMAIL.COM’.

    $('#emailnewemail').blur(function() {
        if ($('#originalemail').text().toLowerCase() === $('#emailnewemail').val().toLowerCase()) {
            $('#emailnewemailoff').html("Same as current email address");
            $('#emailconfirmationoff').html("");
            return false;
        } else {
            $('#emailnewemailoff').html("Not the same email address");
        }
    });
    

    See http://fiddle.jshell.net/jhfrench/EZp6R/ for a working example.

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

Sidebar

Related Questions

I feel like I'm missing something obvious, but I can't work out why my
I feel like this has to be a duplicate, but I can't seem to
I feel like this question ought to have been covered, but I can't seem
I feel like this is a rather simple question, but I can't seem to
Feel like I'm missing something simple here - When I submit this form it
I feel like this should be simple but i can't work out how to
I feel like this should be an easy question but I can't seem to
I feel like there's something about grids that I'm missing, but I can't find
I feel like this is a dumb question and I'm missing something, but I
I feel like I've only ever seen this here on SO, but I can't

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.