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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:17:08+00:00 2026-05-31T10:17:08+00:00

How would I alert the user if they selected more than one COP1000 and

  • 0

How would I alert the user if they selected more than one COP1000 and in another instance alert the user if they selected more than one COP 2830. Right now it notifies the user if they selected more than one class.

<script type="text/javascript" charset="utf-8">
var p = 0;
$(document).ready(function () {
    $('input:checkbox').click(function () {
        var COP1000 = $(this).attr('data');
        if ($('input:checkbox:is_checked').attr()) {
            p++;
        }
        if (p >= 2) {
            alert('You can only select this class once');
            return false;
        }
    });
});
</script>

Below are checkboxes with data being the name of the class

<input name="class[]" data="COP1000" value="<tr><td>COP1000 <td>8:00AM-9:00AM 
</td><td>MWF </td><td>Sanford </td><td>3</td></tr>" type="checkbox" class="auto-
style88"/>
<input name="class[]" data="COP1000" value="<tr><td>COP1000 <td>11:30AM-12:00PM
</td><td>TTH </td><td>Altamonte </td><td>3</td></tr>" type="checkbox" class="auto-
style88" />

<input name="class[]" data="COP2830" value="<tr><td>COP2830 <td>11:00AM-12:00PM 
</td><td>MWF </td><td>Sanford </td><td>3</td></tr>" type="checkbox" class="auto-
style88"/>
<input name="class[]" data="COP2830" value="<tr><td>COP2830 <td>6:00PM-8:45PM 
</td><td>T </td><td>Altamonte </td><td>3</td></tr>" type="checkbox" class="auto-
style88"/>
  • 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-31T10:17:09+00:00Added an answer on May 31, 2026 at 10:17 am

    This should work:

    $(document).ready(function() {
        $('input:checkbox').click(function() {
    
            var COP1000Counter = 0;
            var COP2830Counter = 0;
    
    
            $('input:checkbox:checked').each(function(){
                if($(this).attr('data') == "COP1000")
                {
                    COP1000Counter++;
                } else if ($(this).attr('data') == "COP2830"){
                    COP2830Counter++;
                }
            });
    
            if (COP1000Counter > 1 || COP2830Counter > 1) {
                alert('You can only select this class once');
                return false;
            }
        });
    });
    

    By adding more counters or in the if other numbers you can play with all classes and the number of allowed occurences

    Fiddle

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

Sidebar

Related Questions

I need to display an alert to a user, if they have been on
I am looking to alert the user if they hit the back button while
What would be the best way to send an alert message to the user
I would like to display a custom alert, rather than simply true or false.
I would like to add a custom alert sound to my iOS app. I
I would like to put a link to a webpage in an alert dialog
In an app I'm coding I would like to make an alert message to
My webapp alert looks like this: InputCoordinates.html Latitude must be filled out. I would
I have an alert box with a list of channels. I would like to
I want to display a form in a Div, in alert box. How would

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.