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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:54:06+00:00 2026-05-21T03:54:06+00:00

Taking this basic example of jQuery Validate (see link below), how can you instruct

  • 0

Taking this basic example of jQuery Validate (see link below), how can you instruct it to show the error messages inside the form elements, where possible (obviously checkboxes wouldn’t work)?

http://docs.jquery.com/Plugins/validation#source

  • 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-21T03:54:07+00:00Added an answer on May 21, 2026 at 3:54 am

    Obviously you’ll want to tailor it for your own form, but absolute positioning may help you here. For the example you cited:

    [Truncated] markup:

    <form class="cmxform" id="commentForm" method="get" action="">
     <fieldset>
       <legend>A simple comment form with submit validation and default messages</legend>
       <p>
         <label for="cname">Name</label>
         <em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" />
       </p>
     </fieldset>
    </form>
    

    CSS:

    .cmxform p{position:relative;}
    .cmxform label.error{position:absolute; left: 11.7em; top:5px; display:block; width:180px; /*Computed width of text input was 189px*/ overflow:hidden;}
    

    Of course, this approach does have one major drawback, and that is that the error label will hang above (and over) what the user is typing. On the jquery.com example, I had a red “Please enter at least 2 characters” message over the first letter of my name as I was typing. To remedy this, you’d want to do something like this:

    $(document).ready(function(){
      $('.cmxform input[type=text]').focus(function(){
        $(this).siblings('.error').hide(); // Hide the error while the user is typing
      }).blur(function(){
        if( !$('#commentForm').validate().element(this) ){ // Re-validate this element, show the label if still invalid
          $(this).siblings('.error').show();
        }
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Taking this article on classes and structs as an example: http://msdn.microsoft.com/en-us/library/ms173109.aspx namespace ProgrammingGuide {
I am taking my first steps programming in Lua and get this error when
It is currently said that MD5 is partially unsafe. Taking this into consideration, I'd
Taking advice from this post , I purchased a copy of 'The C Programming
I'm taking over a development of a commercial web site. This site was developed
There is this example code, but then it starts talking about millisecond / nanosecond
I'm talking about this: If we have the letter 'A' which is 77 in
Just finished read this post by Greg Young, where he is talking about Microsoft
Taking over some code from my predecessor and I found a query that uses
Taking shs's question a step further... Why isn't all government sponsored software open source?

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.