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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:39:54+00:00 2026-05-17T22:39:54+00:00

I have a question about the errorPlacement Method in jQuery Validator Plug-in: I want

  • 0

I have a question about the errorPlacement Method in jQuery Validator Plug-in:
I want to put an Error Message in a div.

Before i continue… Yeah, the code is horrible, i’m working in a project that isn’t mine, without documentation or anything that i help me. But i cannot write from zero all the webpage.

Ok, let’s continue, this is a little section of the HTML code:

<tr>
  <th height="24" scope="col">
    <div align="left" class="Style69 Style72 Style75">
      <span class="Style77">Name</span>
    </div>
  </th>
  <th height="24" colspan="3" scope="col">
    <div align="left">
      <span class="Style69 Style72 Style75">
        <input id="txtname" name="txtname" class="required"
        type="text" size="30" />
      </span>
    </div>
  </th>
</tr>
<tr>
  <td height="17" colspan="4">
    <div id="errorMessage"></div>
  </td>
</tr>

The Layout is a table, and, inside of this table are placed all the elements (inputboxes and select’s).

My question is, how can i place the error message in the div “errorMessage”?

I’m doing something like this:

errorPlacement: function(error, element) {
   error.appendTo(element.prev().next().next());
 }

But it doesn’t work. Then, I’ve Tried This:

errorPlacement: function(error, element) {
   error.appendTo(element.prev().next().next().find("#errorMessage"));
 }

And nothing happens.
The “Div” and “Span” tags are part of the DOM?

Any Suggestion?

  • 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-17T22:39:55+00:00Added an answer on May 17, 2026 at 10:39 pm

    The problem here is that .prev() gives no results, there’s no previous sibling to your <input> here:

      <span class="Style69 Style72 Style75">
        <input id="txtname" name="txtname" class="required"
        type="text" size="30" />
      </span>
    

    Something like this should work:

    errorPlacement: function(error, element) {
      element.closest('tr').next().find('.errorMessage').append(error);
    }
    

    This uses .closest() to go up to the <tr>, gets the .next() sibling (the next <tr>) then .find() to get the class="errorMessage" element inside.

    With this, change your id to a class, like this:

    <div class="errorMessage"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question about python and sqlite3. I want to drop a table from
I have question about my code which does the Hoare Partition Method. Here is
I have a question about how CoCreateInstnace() method locate and create an instance of
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have a question about using streams in .NET to load files from disk.
I have a question about best practices regarding how one should approach storing complex
I have a question about locking. This doesn't have to be only about record
I have a question about how to deploy WPF application into a PC without
I have a question about using os.execvp in Python. I have the following bit
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,

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.