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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:21:00+00:00 2026-06-02T10:21:00+00:00

I have a script that works great, but I have one small problem. I

  • 0

I have a script that works great, but I have one small problem.

I just added to my script:

        if (isError) {
            $('html, body').animate({
                scrollTop: 0
            }, 2500);
        } else {
            $("#error-div").hide();
        }   

Now I have a problem. The last input validation set $(‘#input_1 input’) is hiding the error-div when I type something in the input. All the other inputs are red with background changes, but the error-div disappears – only when I remove the error from #input1, which is the last one in the script.

the last input turns off the div-error if there is no error ONLY in that input.

Can’t figure it out. Any suggestions would be great.

$(function () {
$('#rbSubmit').formValidator({
    scope: '#form_register',
    onError: function () {
        var isError = false;
        if ($('#input_38 textarea').hasClass('error-input')) {
            isError = true;
            $('#r38 div').css('background-color', '#C1272D').css('color', '#FFF');
            $("#error-div").show();
        } else {
            $('#r38 div').css('background-color', '#2F2F2F');
            $("#error-div").hide();
        }
        if ($('#input_39 input').hasClass('error-input')) {
            isError = true;
            $('#r39 div, #r39 input').css('background-color', '#C1272D').css('color', '#FFF');
            $("#error-div").show();
        } else {
            $('#r39 div').css('background-color', '#2F2F2F');
            $("#error-div").hide();
        }



       // LAST DIV ALONE WILL TURN OFF THE div-error!!!  HELP!!!


        if ($('#input_1 input').hasClass('error-input')) {
            isError = true;
            $('#r1 div, #r1 input').css('background-color', '#C1272D').css('color', '#FFF');
            $("#error-div").show();
        } else {
            $('#r1 div').css('background-color', '#2F2F2F');
            $("#error-div").hide();
        }
        if (isError) {
            $('html, body').animate({
                scrollTop: 0
            }, 2500);
        } else {
            $("#error-div").hide();
        }
    }
});
});

​

  • 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-02T10:21:02+00:00Added an answer on June 2, 2026 at 10:21 am

    Why are you executing $(“#error-div”).show(); and $(“#error-div”).hide(); within each if else block? Surely if an error has been detected you can perform it at the end:

    if (isError) {
        $('html, body').animate({
            scrollTop: 0
        }, 2500);
        $("#error-div").show();
    } else {
        $("#error-div").hide();
    }
    

    What jQuery plugin are you using for the validation?

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

Sidebar

Related Questions

I have the following code that works fine in IE: <HTML> <BODY> <script language=JavaScript>
I have a script that works great. It is quite complex and does numerous
I have this script that works, but I need to change the format of
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The
I have this script that I am currently running that works great for all
I have a rule that works for one direction but, not the other. A
Ok so I have a bit o' script that works in FF but not
I have a script that works fine on my test server (using IIS6). The
With help from you guys I now have a script that works like a
I have the following script that works well in Firefox and Chrome (not sure

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.