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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:45:13+00:00 2026-05-20T10:45:13+00:00

I have an overview list, with divs, and also each div has a pair,

  • 0

I have an overview list, with divs, and also each div has a pair, which contains all the details. If you click on the “intro” div then the detailed pair is open and the intro is got hidden. Eeach div has a checkbox. And I bumped into a problem, if I click the “intro” div’s checkbox the detailed div will be open, because the click event also happen on the intro div as well. I came up with a solution like, using a external span, where I store all the opened div ids.

<div class="divIntroHolder" id="divIntroHolder15">
            <span class="spanChkHolder"><input type="checkbox" name="Nr" value="15" class="chkMessage" id="chkMessage15"/></span>

        </div>

        <div class="divDetailHolder" id="divDetailHolder15">
            <div class="divPicContainer">
                <span class="spanChkHolder"><input type="checkbox" name="Nr" value="15" class="chkMessage"/></span>
            </div>
        </div>

for this i have a js like this

$(document).ready(function () {
$(".divIntroHolder").click(function () {
    var id = getId($(this).attr("id"));
    if (!isOpen("spanOpenDivs", id)) { //check if the div is open or not
        addTo("spanOpenDivs", id); // add to span
        $(this).hide();
        $("#divDetailHolder" + id).show();
    } else {
        removeFrom("spanOpenDivs", id); //remove from the span
    }
});

$(".chkMessage").click(function () {
    var id = $(this).val();
    //prevent opening the detailed div
    if (!isOpen("spanOpenDivs", id))
        addTo("spanOpenDivs", id);

    var clicked = $(this);
    $(".chkMessage").each(function () {
        if ($(this).val() == id) {
            $(this).attr("checked", clicked.attr("checked"));
        }
    });
 });

});

Its makes the js a bit complicated, and I assume there must be a more easy way to single out a checkbox click event. It shouldnt matter if a checkbox is checked or unchecked, but it should just filter out the click event.

If anybody has a simple solution for this matter, it would be appreciated a lot=)

  • 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-20T10:45:13+00:00Added an answer on May 20, 2026 at 10:45 am
    $(".chkMessage").click(function (evt) {
        evt.stopPropagation();
        ...
    }
    

    jQuery event.stopPropagation()

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

Sidebar

Related Questions

I have a overview page containing a list with some links from which multiple
Overview I have an iOS project which contains 2 navigation controllers as shown in
Overview: I have an Expandable List View which displays items of the type ToDoElement
Situation Overview I'm using Ext.NET GridPanel to display a list of projects which has
Overview I have an iOS project in which I store a list of names
Overview I have an iOS app which sends local notifications at specific dates. I
Problem Overview: My application has an enrollment form. Users have a habit of entering
For example, this list contains an overview of documents and needs to allow paging.
I have an unordered list as follows: <ul id=menu> <li><a href=#>Event Overview</a> <ul class=sub-menu>
I have a unordered list where every <li> has a different ID and a

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.