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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:20:41+00:00 2026-06-13T00:20:41+00:00

I am trying to validate using jquery validation and the error messages displayed it

  • 0

I am trying to validate using jquery validation and the error messages displayed it in a div container. My problem is when i typed something to my input fields error message always appear in “div.info” but i just want error messages always appear when i submit a form. And my next problem is when i submit more than once error messages also display more than once too?

My code is like below

Html code

<div class="info"></div>
 <form id="fmlogin">
  <fieldset>
    <label>Email Address</label>
    <input type="text" name="email" />
    <label>Password</label>
    <input type="password" name="password"/>
    <input type="submit" value="login" />
  </fieldset>
 </form>

jquery

<script type="text/javascript">
        $(document).ready(function(){       
        $("form#fmlogin").submit(function() {
            data= $("form#fmlogin").serialize();
            return false;
        });

        $("#fmlogin").validate({
            rules: {
                email: {
                    required: true,
                    email:true
                },
                password: {
                    required: true,
                }
            },      
        messages: {
            email: {
                required: "Email Address is required",
                email:"Email Address is not Valid"
            },
            password: {
                required: "Password is required",
            }
          },
        errorElement: "div",
        wrapper: "div", 
        errorPlacement: function(error, element) {  
            error.appendTo($('.info'));
        },
        submitHandler: function(form){          
            $.ajax({
                type: "POST",
                url: "login.php",
                data:data,
                success: function(response){
                    $(".info").text(response);
                }   
            }); 
        }
        }); 
        });
</script>   

I am new with jquery validation, please help?

Thanks

  • 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-13T00:20:43+00:00Added an answer on June 13, 2026 at 12:20 am

    fmlogin

    use this

      var data=$("#fmlogin").serialize();
     $("#fmlogin").submit(function(){
       $.ajax({
                type: "POST",
                url: "login.php",
                data:data,
                success: function(response){
          //if you want to show error more that once than use append instead of text
                    $(".info").append(response);
                }   
        })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery's validation plugin to validate form text fields. I'm trying to validate
I'm using the validate plugin from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ What i'm trying to find is a
I am trying to using a jquery.validate.unotrusive.js plugin to dynamically created form fields like:
I'm trying to use jQuery validation plugin to validate a few form fields by
I am trying to move focus to a validation error message using Jquery. By
i'm trying to validate a form using jquery, ajax and json using codeigniter's validation,
I am using jQuery Validator to validate user input. I am trying to figure
I am trying to validate username field in my form using jquery validation plugin.
i'm trying to validate an html page using jquery, but nothing happens. it's a
I was trying to validate dates using java script on button click event.If validation

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.