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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:43:45+00:00 2026-05-11T09:43:45+00:00

On the first click, it works as expected: the class is changed and the

  • 0

On the first click, it works as expected:

  1. the class is changed
  2. and the html content is changed from ‘Show…’ to ‘Close…’
  3. the content area is expanded with the slideDown effect,

Good so far.

On the second click, …

  1. the class changes
  2. the html content is changed from ‘Close…’ to ‘Show…’
  3. The content area does NOT go away as expected.

On the third click, …

  1. the class is changed
  2. the html content is changed
  3. the already-shown content is re-shown with the slidedown effect.

So everything is working except for the 2nd click when the content is supposed to be hidden again.

Here’s the jQuery:

–

$('.open_user_urls').live('click', function() {     $('#user_urls').slideDown('slow');     $(this).addClass('close_user_urls');     $(this).removeClass('open_user_urls');     $(this).html('Close Search History');     return false; });  $('.close_user_urls').live('click', function() {     $('#user_urls').slideUp('slow');     $(this).addClass('open_user_urls');     $(this).removeClass('close_user_urls');     $(this).html('Show Search History');     return false; });  

Here’s the HTML it’s acting on:

<h3 class='open_user_urls'>Show Search History</h3> <div id='user_urls'> // an OL tag with content </div> 

And the only applicable CSS:

#user_urls { display: none; } 

EDIT – I replaced my jquery code with functionally equivalent code supplied in an answer below, but the problem persists. So the cause must be elsewhere. I do recall this code working originally, but then it stopped. I’m stumped. Time to strip everything else out piece by piece…

EDIT 2 – Since the bug must be elsewhere, I’m accepting a code improvement for my jquery as the answer. Thanks.

Edit 3 – Found the source of the problem.

Inside the #user_urls div I have an series of OLs with the following css:

.url_list {float: left; width: 285px; list-style-position: outside; margin-left: 25px;} 

Each OL contains a list of 20 urls and is meant to display in as many multiple columns as required to display all the URLs.

Removing the float: left; on these OL tags causes the problem to go away.

So having a float on the content contained in the DIV thats showing and hiding is causing it not not hide at all. Why would this happen?

EDIT 4: Adding a inside the #user_urls DIV allows the hiding action to work properly.

  • 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. 2026-05-11T09:43:46+00:00Added an answer on May 11, 2026 at 9:43 am

    Perhaps something like this would be simpler?

    $('.open_user_urls').toggle(     function () {         $(this).text('Close Search History').siblings('.user_urls').slideDown('slow');     },     function () {         $(this).text('Show Search History').siblings('.user_urls').slideUp('slow');     } ); 

    The toggle function is designed for precisely the scenario you’re encountering.

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

Sidebar

Related Questions

When I click on the button, the first time, everything works fine, but the
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
I change some methods from $(selector).live('click', function(){}); to $(selector).on('click', function(){}); . At first it
The first submit works as expected, but the next time it's fully posted back.
Please visit this link Click on first Image. Now is showing the Modal page
My Requiremet is when i Click on first button ,my panel should me me
I'm creating a fileupload control on a linKbutton click event. First time it's creating
Here is my jquery code: $('input').click(function(){ $('h1').empty().queue(function(){ console.log('queue'); }); }); }); Only the first
I have a fairly simple code, a button click event, with the first line

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.