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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:08:50+00:00 2026-06-12T09:08:50+00:00

I have a Jquery validation of form as follows: $(this.initVariables.formId).validate({ errorElement: div, errorPlacement: function(error,

  • 0

I have a Jquery validation of form as follows:

$(this.initVariables.formId).validate({
     errorElement: "div",
     errorPlacement: function(error, element) {
        error.insertBefore(element.parent());
     }
}

The problem is when an error appears, the form becomes distorted as follows:
enter image description here

What I want to do is to adjust effectively the neighbor field the same line as the error field as follows:
enter image description here

HTML code of div is:

<div class="relatedField>
    <div id="wwgrp_addForm_summaryData_firstName" class="wwgrp" style="float: left; padding-right: 6px;">
          <div id="wwlbl_addForm_summaryData_firstName" class="wwlbl"> 
              <label class="label" for="addForm_summaryData_lastName"> FIRST NAME </label>
          </div>
          <div id="wwctrl_addForm_summaryData_firstName" class="wwctrl">
               <input id="addForm_summaryData_firstName" class="storedPaymentInput_size4 alphabet" type="text" value="" name="summaryData.firstName">
          </div>
    </div>
    <div id="wwgrp_addForm_summaryData_lastName" class="wwgrp" style="float: left; padding-right: 6px;">
          <div id="wwlbl_addForm_summaryData_lastName" class="wwlbl"> 
              <label class="label" for="addForm_summaryData_lastName"> LAST NAME </label>
          </div>
          <div id="wwctrl_addForm_summaryData_lastName" class="wwctrl">
               <input id="addForm_summaryData_lastName" class="storedPaymentInput_size4 alphabet" type="text" value="" name="summaryData.lastName">
          </div>
    </div>
</div>

How can i do this using jquery without changing the implementation of my form. I have lots of field beside this. Please help. Thank you.

My solution is

 errorPlacement: function(error, element) {
     error.insertBefore(element.parent());
     element.parent().parent().siblings().each( function () {
           var child = $(this).children("div.wwctrl");
        $("<div class='SPACE'>&nbsp;</div>").insertBefore(child);
      });
 }

But as you could see, it is not clean and after the correct validation, the div space is not removed.

enter image description here

Any idea on how to do this better.

Thank you.

  • 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-12T09:08:51+00:00Added an answer on June 12, 2026 at 9:08 am

    What if you look at the height of your “ALPHABETS ONLY!” element and just add that much padding/margin to the top of your other input field to push it down exactly that much?

    This way, you would avoid creating any new elements, but you’d have to remember to remove this margin/padding when you get rid of the “ALPHABETS ONLY!” element.

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

Sidebar

Related Questions

I have this jQuery validation control in my form. It's working: $(#webform-client-form-45).submit(function(){ if($(#edit-submitted-name-surname).val() ==
I have this AJAX submission form written with the jQuery validation plugin. It all
I have jQuery validation on my form. When I click submit button, 'save' function
I have used http://bassistance.de/jquery-plugins/jquery-plugin-validation/ my form validate : $(#form_person).validate({ rules: { username: { required:
I have a form that uses the excellent jQuery validation plugin. This is a
I am using jQuery validation plugin and have defined a form validation function as
Is it possible to have a jquery validation code on a form element directly
I am using jquery validation plugin for form validation. I have added a custom
We have a form which uses the JQuery Validation Plugin and would like to
I have a simple form and would like to add a custom jQuery 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.