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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:58:02+00:00 2026-05-26T06:58:02+00:00

I have a toggle panel script in jQuery whereby my content expands and collapses

  • 0

I have a toggle panel script in jQuery whereby my content expands and collapses when I click the h2 element.

Problem is I have input fields in that h2 element, which come about when I try to edit something using jEditable. I would like to find a way so that when I click on that input field, I don’t get a click event.

My guess is somehow to use the :not selector method but I’ve tried a bunch of iterations to no avail.

CODE

    //toggle panel content
    $(".panelcollapsed h2").click(function(){
        $(this).siblings(".panelcontent").slideToggle(100, 'easeInQuad');
    });
  • 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-26T06:58:03+00:00Added an answer on May 26, 2026 at 6:58 am

    You could test to see if the event originated on an input element, and ignore it if it did:

    $(".panelcollapsed h2").click(function(e){
        if (e.target.tagName.toLowerCase() === 'input') {
            return;
        }
    
        $(this).siblings(".panelcontent").slideToggle(100, 'easeInQuad');
    });
    

    This checks the tagName of e.target, the element where the event originated, to see if it is the same as input. If so, return exits the event handler.

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

Sidebar

Related Questions

I have a toggle button using this code: <script> jQuery(document).ready(function(){ jQuery('#MyToggleSwitch').live('click', function(event) { jQuery('.ElementToHideAndShow').toggle('show');
I have this jQuery: $(document).ready(function() { $(#panel).hide(); $('.login').toggle( function() { $('#panel').animate({ height: 150, padding:20px
I have a jquery toggle that animates and displays a DIV. I have a
I have some code that acts as a click toggle for a menu. I
i have a panel having slide toggle effect on click of a button along
I have this little script to toggle a contact form when a button is
I have some HTML that I need to toggle between two structures - one
I have a div that I want to toggle between displaying or not when
I have a panel that fades images in and out. However, the first image
I have a simple piece of jquery i am using to toggle the visibility

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.