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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:10:51+00:00 2026-06-08T07:10:51+00:00

Hello Friends i m getting blocked with a confusing error its seems simple but

  • 0

Hello Friends i m getting blocked with a confusing error its seems simple but i cant got it done i just want to toggle a div on clicking on an ID and change the html() of this ID like currently its showing Hide when user click on it then its show ‘show’ but in my code its not happend and the panel works fine with toggle effect Please check DEMO. Please help me
Thanks in advance ….

  • 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-08T07:10:53+00:00Added an answer on June 8, 2026 at 7:10 am

    You are making this MUCH more difficult than it needs to be. This is how I would do it:

    $('#showhide').click(function(){
      var div = $(this);
      $('.camera_discription_cont_text_container').slideToggle('slow',function() {
          div.html($(this).is(":visible") ? "hide" : "show");
      });
    })
    

    But to actually explain what is wrong with your code, you want to use “else if” instead of the second “if” statement, as such:

    $('#showhide').click(function(){
    
        if($(this).html()=='hide') {
            $(this).removeClass('hide');
            $(this).addClass('show');
            $(this).html('show');
        }
        else if($(this).html()=='show') {   //note the "else if", not "if"
            $(this).removeClass('show');
            $(this).addClass('hide');
            $(this).html('hide');
        }
    
        $('.camera_discription_cont_text_container').slideToggle('slow', function() {
            // Animation complete.
        });
    
    })
    

    If in your first if statement, you are changing the html to “show”. Then the statement finishes, and you are saying “if html is ‘show’, change it to hide”. So then it changes to hide. In other words, it is changing from hide to show to hide. Using “else if” is what you want.

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

Sidebar

Related Questions

hello friends i designed a floating div and its working perfectly but due to
Hello friends I am getting the following error while making the foreign key 'tbl_course'
Hello Friends I want to upload a image but according to requirement when click
hello friends i just want to know that whether we can access or fetch
Hello friends i am working on jQuery cycle plugin its cool but i am
Hello friends I have tried many times but I am not successful than please
Hello Friends check my code http://jsfiddle.net/sUaky/2/ i want to load a web page in
hello friends i want to use toggle on <li> when one <li> is open
Hello friends i want to add more effects on my div when i click
Hello friends it may sound awkward but i am novice to asp dotnet web

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.