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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:56:26+00:00 2026-06-13T19:56:26+00:00

I need to be able to tell if the checkboxes are checked to do

  • 0

I need to be able to tell if the checkboxes are checked to do some basic validation. Problem: I don’t have access to the PHP generating this. There is no class added, or the basic checked=checked that most forms have. What’s the easiest way to target the checked boxes?

http://www.inpresence.in/event-registration?ee=4

EDIT: freak out!! here’s the code, i just need to target the checked boxes, everything else is working. the :checked method of jquery uses checked=checked within the checkbox, which isn’t there.

   $(document).ready(function(){
    //when the submit button is clicked...
    $("input.btn_event_form_submit").click(function(){

    //find the value of the drop down with one evening or four evenings
    var priceOption = $("#price_option-4").val();

    //match a string ending with "one evening" as the first numbers will be randomly generated by php
    var oneEvening = /^\d{2}\|One Evening$/.test(priceOption);

    //match a string ending with "four evenings" as the first numbers will be randomly generated by php
    var fourEvenings = /^\d{2}\|Four Evenings$/.test(priceOption);

    //HOW DO I GET THE CHECKED BOXES?!
    var checkedBoxCount = $('#dates-1351733097 .valid').is(':checked').length;

    //if one evening is selected make sure the checked boxes count does in fact equal one
    if(oneEvening && checkedBoxCount != 1){
        //if it doesn't alert the user and return false
        alert('You must select one date');
        return false;
    }

    //if one evening isn't selected, four is. make sure the count does indeed in 4
    else if (fourEvenings && checkedBoxCount != 4){
        //if it doesnt alert the user and return to the form
        alert('You must select four dates');
        return false;
    }

    //else, everything checks out!
    else {
        return;
    }

});
});
  • 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-13T19:56:27+00:00Added an answer on June 13, 2026 at 7:56 pm

    Using this JavaScript code you can check if a checkbox is checked:

    var isChecked = document.getElementById("my-checkbox").checked;
    

    Or using jQuery:

    var isChecked = $('#my-checkbox').is(':checked');
    

    EDIT: Try this and tell me if it works:

    var checkedBoxCount = $('#dates-1351733097 .valid:checked').length;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to tell if a link (URL) points to an
I need to be able to access a list throughout my Rails project. For
I need to be able to create an id for a hyperlink. I have
I need to be able to tell the user if their password is strong
I need to be able to tell the difference between a string that can
I need to be able to tell from within a VB.NET class (not a
From an NT shell script, I need to be able to tell if the
I have a few ideas about this but here is what I need to
I need to be able to tell if a page is being viewed in
I need to be able to tell if an image exists in a directory

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.