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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:45:08+00:00 2026-06-13T06:45:08+00:00

Got this piece of code for a dropdown textarea. Goal is to have div.card

  • 0

Got this piece of code for a dropdown textarea. Goal is to have div.card show/hide when the checkbox is clicked, and this works, but clicking div.card itself makes it hide itself, how could I prevent this from happening?

Jquery looks like this

$('.options .checkbox').click(function(){ 
    $('.options .card').toggleClass("hidden").toggleClass("show");
});

HTML looks like this

<label>
Label description
<strong>
    + € 0,50
</strong>
<input class="checkbox" type="checkbox">
    <div class="card hidden">
        <textarea>
        </textarea>
    </div>
</label>
  • 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-13T06:45:10+00:00Added an answer on June 13, 2026 at 6:45 am

    You can prevent the click event from bubbling up to the parent:

    $('.card').click(function(e) {
        e.stopPropagation()
    });
    

    Or, you could verify that the target element is really the one you’re after:

    $('.options .checkbox').click(function(e) {
        if (!$(e.target).hasClass('checkbox')) return false; 
    
        $('.options .card').toggleClass("hidden").toggleClass("show");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hallo all. I got this piece of code: <div> <input id=id1 name=radioButton type=radio> <input
I have got a piece of code, that should countdown some number (in this
I have the this piece of code here... <div class=pics2> <div style=position: absolute; top:
I have got this piece of code: public class ThreadInteraction { public static void
I've got this piece of code to toggle a side panel: $(.example_wrapper_panel_link).click(function() { $(.example_wrapper).addClass('example_wrapper_active');
so i got this piece of code. (currPosX is defined earlier) while (earliestDate <
I've got this piece of code in my jquery validation script: resetForm: function() {
I got this piece of Assembly code extracted from some piece of software, but
So I got this little piece of code, don't bother the way it's implemented.
I've got this piece of legacy code which I'm trying to refactor at the

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.