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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:36:01+00:00 2026-06-16T18:36:01+00:00

Edit I realized my error shortly after posting this. The append should be html()

  • 0

Edit I realized my error shortly after posting this. The append should be html() or text()

Partial code:

<script type="text/javascript" language="javascript">
        $(document).ready(function(){
            $('#resetpassword').validate(
            {rules: {
                secretAnswer: {
                    required: true
                }
            },

            messages: {
                secretAnswer: {
                    required: "Please answer your security question"
                }
            },
            submitHandler: function(form){
                $.post("../BackgroundOperations/resetpassword.php",
                    $('#resetpassword').serialize(),
                    function(data){
                        if(data.status == 0){
                            $('#message').append("<span class='error'>Error: " + data.message + "</span>");
                        }
                        else{
                            $('.container').hide();
                            $('.short_explanation').hide();
                            $('#message').text(data.message);
                        }
                    },
                "json");
            }
            });
        });
    </script>
</head>
<body>

<!-- Form Code Start -->
<div id='fg_membersite'>
<form id='resetpassword' method='post' accept-charset='UTF-8'>
<fieldset >
<legend>Reset Password</legend>

<div class='short_explanation'>* required fields</div>
<input type='text'  class='spmhidip' name='<?php echo $vm->GetSpamTrapKey(); ?>' />

<div id="message"></div>
<div class='container'>
    <label for='emailAddress' >Email Address:</label><br/>
    <input type='text' name='emailAddress' id='emailAddress' maxlength="100" readonly="true" value="<?php echo $vm->GetEmailAddress() ?>" /><br/>
</div>
<div class='container'>
    <label for='secretQuestion' >Security Question:</label><br/>
    <input type='text' name='secretQuestion' id='secretQuestion' value='<?php echo $vm->GetSecretQuestion() ?>' maxlength="100" readonly="true" width="100" /><br/>
</div>
<div class='container'>
    <label for='secretAnswer' >Answer:</label><br/>
    <input type='text' name='secretAnswer' id='secretAnswer' maxlength="50" /><br/>
</div>
<div class='container'>
    <input type='submit' name='Submit' value='Submit' />
</div>

</form>

I’m testing invalid input (wrong security answer). When I put the wrong answer and submit the form the <div id="message"> gets updated with the error message, but if I keep submitting invalid data the <div id="message"> keeps the old error message with a new one added on the end instead of having just a single message.

  • 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-16T18:36:02+00:00Added an answer on June 16, 2026 at 6:36 pm

    Instead of

    $('#message').append("<span class='error'>Error: " + data.message + "</span>");
    

    use

    $('#message').html("<span class='error'>Error: " + data.message + "</span>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: I realized that this code compiles and works: #include <iostream> template<class Something> class
EDIT: I just realized that this question may be better suited to ServerFault. Instead
Edit: I've realized my error (if statement, variable x is assigned to element in
For my PHP script I have this code: if (!preg_match(/[^A-Za-z]/, $usersurname)) $usersurname_valid = 1;
EDIT: I have realized the source of my problem. I only have count information
EDIT 2: I have just realised that my HTML is only displaying the artist
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: iam using ajax to load text in my content that is why onload
EDIT : It turned out that this can only be done through an external
EDIT: Thx to suggestions from the mailing list I realized that the problem I

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.