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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:04:56+00:00 2026-05-31T02:04:56+00:00

I have some JavaScript form validation I’m using before I send it across to

  • 0

I have some JavaScript form validation I’m using before I send it across to my PHP. (I’m still learning). but my question for you today is how I would get my error message to shake without reloading the page. My below JS code seems to reload the page when I click submit. The error message style is set to disply:none; by default and only shows when needed.

I hope you understand what I am getting at. ha ha Thank you in advance.

Here’s the js code.

function validateLoginForm() {
    var x = document.getElementById('email').value;
    if (x == null || x == "" || x == "Email") {
        document.getElementById('errorWrapper').style.display='block';
        document.getElementById('errorText').innerHTML='Please enter your Email address!';
        shakeIt();
        return false;
    }
}

and the jQuery.

$(document).ready(function() {
    function shakeIt(){
        $('#errorWrapper').effect("shake", { times:5, distance:8 }, 50);
    }
});
  • 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-05-31T02:04:57+00:00Added an answer on May 31, 2026 at 2:04 am

    You need to do it on form.submit ie

    $('#loginForm').submit(function(e){
    var x= $('#email').val();
          if (x==null || x=="" || x=="Email")
          {
          $('#errorWrapper').show();
          $('#errorText').text('Please enter your Email address!');
          e.preventDefault();
          shakeIt();
          }
          return true;
    });
    

    Returning false will make the page not reload..

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

Sidebar

Related Questions

I have some client-side JavaScript validation on a form. It works great. But I
I am doing some basic form validation. I have the following JavaScript function: function
I have some javascript which catches changes to a form then calls the form's
I have some javascript that I'm trying to retool using jQuery to learn the
i have some javascript roll over code that works fine in firefox but when
I have a php page and i have some javascript code to have a
I have some JQuery form validation where im checking the length of the username
I have added some javascript in html page for input validation.same page is working
Within my web application I am using some custom validation for my form fields.
I have a form using jquery validation plugin. My submit button has an ajax

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.