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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:18:30+00:00 2026-06-02T16:18:30+00:00

I am using jQuery Validator to validate user input. I am trying to figure

  • 0

I am using jQuery Validator to validate user input. I am trying to figure out when should i clear the custom error icon displayed next to the invalid element. The code posted below keeps appending the error icon. I tried to clear it in showErrors event, but no luck.

 $("#form1").validate({
                onfocusout: false,
                onKeyUp: false,

                rules: {

                 txtDate:{
                    required: true
                 },
                 txtType:{                   
                      required: true
                 },
                 ddlTime:{                   
                      required: true
                 }
               },
               messages: {
                ddlTime: {                   
                      required: "Please select an option for Time"
                 },
                 txtDate:{
                    required: "<br>Please enter valid date"
                 },
                 txtType: {                   
                      required: "<br>Please Enter valid type"
                 }
               },
               errorPlacement: function(error, element) {
                    error.wrap("<li></li>").appendTo($("#dvErrorSummary")); 
                    $('<div class="errorIcon"></div>').insertAfter(element);
                  }
             }); 

This is how my css looks like:

label.error {
    color: red;
    font-style: italic
}

    .errors { color: red; }
    .errorIcon 
    { 
        background: url(../errorIcon.png); 
        width: 16px; 
        height: 16px;
        display:inline;

    }

This is how my HTML Looks Like:

<body>
<html>
<head runat="server"></head>

        <form id="form1" runat="server">

            <ul id="dvErrorSummary" name="dvErrorSummary" class="errors"></ul>

             <select id="ddlTime" name="ddlTime" </select>
             <input id="txtDate" name="txtDate" />
             <input id="txtType" name="txtType" />

       </form>
</body>
</html>
  • 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-02T16:18:32+00:00Added an answer on June 2, 2026 at 4:18 pm

    This is the piece, where you are adding the error message container

    errorPlacement: function(error, element) {
                        error.wrap("<li></li>").appendTo($("#dvErrorSummary")); 
                        $('<div class="errorIcon"></div>').insertAfter(element);
                      }
    

    May be use can check the length property to insert errorIcon only if the value is less than 1.

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

Sidebar

Related Questions

I'm using jQuery Validate plugin and store Error messages in title, e.g.: <input type=text
I have the following code using jQuery Validate. $(#register).validate({ debug: true, errorClass:'error', validClass:'success', errorElement:'span',
I am using the jQuery validate plugin . My error labels are styled like
I m using jquery validator plugin. i need to validate some field with some
I am developing a website using PHP. I use Javascript/jquery to control/regulate user input.
I'm trying to validate a form using the validate plugin for jquery. I want
I'm currently using the jQuery Validate plugin for my input validation. It is used
I wrote a custom validator using MVC DataAnnotations and the jQuery unobtrusive javascript library.
I am using asp.net mvc 3 jquery validate unobstructive javascript. I am trying to
I am trying to move focus to a validation error message using Jquery. By

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.