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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:09:34+00:00 2026-05-27T21:09:34+00:00

I want to run a function that removes a number of divs when a

  • 0

I want to run a function that removes a number of divs when a check box is unchecked. The divs contain a class that has to match with the check boxes class for it to be removed.

The variable matchedDots is getting the divs that match the variable class of checkBoxID.

checkBoxID is the class of the check box being unchecked.

       var checkBoxID = $(this).attr('class');

       var matchedDots = $('.current-map').find('div').hasClass(checkBoxID);

        if (!$(this).is(':checked'))
        {
            //do something
        };

So really what im trying to do is say “IF the check box is unchecked AND the div class matches up with the checkbox’s class, do something.

I don’t need the info of how to remove the divs, just how to select them, as currently all I’m selecting is the unchecked check box.

Thanks guys.

  • 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-27T21:09:35+00:00Added an answer on May 27, 2026 at 9:09 pm

    Sorry if I have been confusing you guys but I have worked it out myself. Here is the code below. It was definitely easier than I thought it would be.

    @Alex, thanks for your input though! really appreciated that.

            var checkBoxID = $(this).attr('class');
    
            if (!$(this).is(':checked'))
            {
    
                $('div.' + checkBoxID).hide();
    
            };
    

    Basically I am getting the class from the check box. Then running an IF statement to see if the check box has been unchecked, if it has, I remove the divs with the same class as the check box.

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

Sidebar

Related Questions

I have the following function that I only want to run inside <div id=imgWrapper>
I have problem with fancybox. I want to write a function that will run
I want to create a function in lisp that receives a number and a
I want to run this function, or at least the bit that deletes the
In JavaScript/jQuery, if I want to have a function that can run on an
I want to run function inside web service (.asmx file) $.ajax({ type: POST, contentType:
I have a C# application, and I want to run a function which is
Let's say I want to run the same function on every one of my
I want to run a simple JavaScript function on a click without any redirection.
I have one r function i want to run it automatically(scheduling) after every predefined

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.