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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:42:12+00:00 2026-06-06T11:42:12+00:00

I am trying to create a checkbox limit based on a value change example:

  • 0

I am trying to create a checkbox limit based on a value change example: I have the following checkbox!

If the value of a checked checked box is different then the previous prompt an alert!
Some of the check boxes do have the same value. Not all of them!

Example:

<input name="" type="checkbox" value="here">(if this was checked)
<input name="" type="checkbox" value="here">(then this)
<input name="" type="checkbox" value="there">(would not allow prompt alert) 
<input name="" type="checkbox" value="here">(would allow)

<input type="checkbox" name="checkbox2[]" onClick="setChecks(this)" value="`key`=<?php 
echo $rspatient['key']?>" class="chk" id="chk<?php echo $a++?>" />

I have code that limits the number of checkboxes but I’m not sure how to compare previous values to the selected.

  • 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-06T11:42:14+00:00Added an answer on June 6, 2026 at 11:42 am

    You probably want to make use of the prev() and next() jQuery functions. I don’t understand well enough what you want to do, but something like $(':checkbox').change(function() { $(this).prev(); //this references the previous sibling }) would get you started

    Maybe something like

    $('input:checkbox').change(function() {
        if ($(this).attr('checked') && $(this).prev().attr('checked') && $(this).attr('value') != $(this).prev().attr('value')) {
             alert('you can't do that');
        }
    });
    

    But like I said, i don’t know what you’re trying to do

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

Sidebar

Related Questions

$(div).append($(document.createElement(input)).attr({ 'id': 'post_category', 'value': 'item', 'type': 'checkbox','checked': true })); I am trying to create
Im trying to grab value from label checkbox:checked. I have created this function var
I'm trying to create a preferences window. In it I have some checkbox style
I was trying to create a checkbox for images where if we have multiple
I am trying to create a checkbox dynamically using following HTML/JavaScript. Any ideas why
I'm trying to create a checkbox with the following code: @Html.CheckBoxFor(Function(model) model.PotentialDishmachineProducts) @Html.ValidationMessageFor(Function(model) model.PotentialDishmachineProducts)
I am trying to create my own Native win32 C++ Checkbox that can have
I have a DataGridView with a checkbox column. I'm trying to create a select/deselect
I am trying to create a ListView with CheckBox's...Th ListView should allow the user
I'm trying to create a set of button which have an off or on

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.