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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:09:18+00:00 2026-05-30T12:09:18+00:00

I have some input elements grouped in different divs, and I need to ensure

  • 0

I have some input elements grouped in different divs, and I need to ensure that inputs in the same group do not have the same value.

Example:

<div class="group1">
    <input name="group1a" id="group1a"/>
    <input name="group1b" id="group1b"/>
    <input name="group1c" id="group1c"/>
    <input name="group1d" id="group1d"/>
<div>
<div class="group2">
    <input name="group2a" id="group2a"/>
    <input name="group2b" id="group2b"/>
    <input name="group2c" id="group2c"/>
    <input name="group2d" id="group2d"/>
<div>

All these inputs have some values (user entered) so I want to check if a user enters the same value in any input of group1 (same as group2, group3, …) then system is going to alert to user “you cannot enter any same value in that group”

What is the most efficient way of doing that with jQuery?

  • 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-30T12:09:19+00:00Added an answer on May 30, 2026 at 12:09 pm

    You could do:

    $('input').blur(function(){
       var curr = this.value;
       if(curr != '' && $(this).siblings('input[value='+curr+']').length > 0){
          alert('you can\'t enter the same value twice in the same group');
          this.value = '';
       }
    });
    

    fiddle here http://jsfiddle.net/QRyWQ/

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

Sidebar

Related Questions

I have some form input elements with class .commission_plan and different IDs. I need
I have a form with some different input elements. One of these is a
I have some elements <input type="text" id="test_value" name="test_value" value="xyz" /> <input id="test_default" name="test_default" type="checkbox"
I have some jQuery plugin that changes some elements, i need some event or
I have some input elements that the users are request special behavior on pageup
We have some input elements on the page: <input type=text class=lovely-input name=number value= />
We have some input data that sometimes appears with &nbsp characters on the end.
I have a dl containing some input boxes that I clone with a bit
I have some jquery variables that attempt to get values of nearby elements however
I have a form that uses a div that is positions over some input

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.