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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:26:53+00:00 2026-05-31T05:26:53+00:00

I am building the validation plugin in my form and everyting is working well.

  • 0

I am building the validation plugin in my form and everyting is working well. But on checkboxes I get this as HTML:

Form Check HTML checkboxes:

<div class="right">
    <div class="custom-checkbox"><input type="checkbox" name="family" value="" id="third-check" class="require-one error"><label for="third-check">Check off</label></div>
    <div class="custom-checkbox"><input type="checkbox" name="family" value="" id="fouth-check" class="require-one"><label for="fouth-check">Check off</label></div>
    <div class="custom-checkbox"><input type="checkbox" name="family" value="" id="five-check" class="require-one"><label for="five-check" class="">Check off</label></div>
    <div class="custom-checkbox"><input type="checkbox" name="family" value="" id="six-check" class="require-one">
    <label for="checks" generated="true" class="error">Please check at least one box.</label>
    <label for="six-check">Check off</label></div>
</div>

As you can see the error is not standing outside the custom checkbox div. How can i do this?

The JS:

$.validator.addMethod('require-one', function(value) {
    return $('.require-one:checked').size() > 0;
}, 'Please check at least one box.');

var checkboxes = $('.right .require-one');
var checkbox_names = $.map(checkboxes, function(e, i) {
    return $(e).attr("name")
}).join(" ");

$(".valid").validate({
    meta: "validate",
    groups: { checks: checkbox_names },
    errorPlacement: function(error, element) {
    if (element.attr("type") == "checkbox") 
        error.insertAfter(checkboxes.last());
    else
        error.insertAfter(element);
    }  
});
  • 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-31T05:26:54+00:00Added an answer on May 31, 2026 at 5:26 am

    Try this:

     error.insertAfter(element.parent());
    

    because you want to add the message after the div (which is the parent) to the current element.

    UPDATE: after chat discussion, the correct anser is:

    error.insertAfter(element.parent().siblings().last());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im building a Jquery form validation plugin. my concern is that my plugin does
I m building a very simple form validation which validates only required fields. This
I'm building form validation controls for our C# ASP application. The bulk of the
I am building a site which uses jQUery validation plugin and want things validated
I am using the jQuery Validation plugin to validate a signup form for my
I'm working on a set of validation classes and am currently building plugins for
I'm building a validation form in my application. In that form there are two
I am building a form using HTML5 form validation. I have the CSS classes
I'm building up a library of filters for a validation class in PHP, some
I'm building an ASP.NET MVC application with a form that needs validation. The majority

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.