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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:11:17+00:00 2026-06-17T16:11:17+00:00

I have two radio buttons in my form for gender selection. I am using

  • 0

I have two radio buttons in my form for gender selection.

I am using this plugin for validation.
When I apply validation on radio button, this plugin places the error label between the two radio buttons.

here is the fiddle: http://jsfiddle.net/wyFQp/1/

HTML:

<head>
    <body>
        <form id='registration_form'>
            <input type="radio" value="M" name="gender" class="gender" id="genderm"
            />Male
            <input type="radio" value="F" name="gender" class="gender ml_10" id="genderf"
             />Female
            <input type='submit' />
        </form>
    </body>

How can I place the error label after both radio buttons? Or at least on some decent place?

  • 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-17T16:11:17+00:00Added an answer on June 17, 2026 at 4:11 pm

    Add an error label in your markup where you’d like the error to show:

    <label class="error" generated="true" for="gender" style="display:none;"></label>
    

    Fiddle

    When associating it with radio inputs, the error label’s for attribute corresponds to radios’ name – this facilitates things as radios with the same name will only have one radio selected at a time and one error label associated with the group.
    For text inputs (and select/textarea/type="checkbox") though, the id must be used.


    Another less hackish way is to use the errorPlacement option with an error container, e.g.:

    <div id="genderErrorContainer"></div>
    
    $("#registration_form").validate({
        rules: {[...]},
        messages: {[...]},
        submitHandler: fn,
        errorPlacement: function(error, element) {
            if (element.prop('name') === 'gender') {
                error.appendTo('#genderErrorContainer');
            }
        }
    });
    

    Updated fiddle

    Of course, you can also use other DOM manipulation methods to add the error element to the DOM, for example .append, .prepend, .after, insertAfter, .before, .insertBefore combined with DOM traversal based on the element that originated the validation error, which may not require extra markup depending on your HTML structure.

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

Sidebar

Related Questions

Im using the bog standard form validation plugin. I have two radio buttons 'yes'
I have a form with two radio buttons. One button id'd as 'trigger_unit', the
I have two radio buttons on my form and up until I started using
I have a form which contains a 'gender' label and two radio buttons'male' and
I have two radio buttons on my MVC form that I use to hide
I have two radio buttons and I want to reset all the validation of
I have a simple form on a website that contains two radio buttons, and
The problem like this, I have a groupBox which contains two radio buttons, when
I'm using jQuery validation to validate a form with a radio button set on
I have a PHP form that presents the user with two radio button options

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.