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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:00:31+00:00 2026-05-16T07:00:31+00:00

I’m using a button to slideToggle the display of my disclaimer here, and for

  • 0

I’m using a button to slideToggle the display of my disclaimer here, and for some reason, I cannot find out how to change the value of the button properly.

Here is my jQuery code:

$(document).ready(function() {

  $('<input type="button" id="toggleButton" value="Hide">')
    .insertAfter('#disclaimer')
    .click(function() {
  $(this).prev().slideToggle('slow');

  if($(this).prev().is(':visible')) {
    $(this).val('Hide');
  } else {
    $(this).val('Show');
  }

  });

});

So, I believe everything is in order except for the

.is(':visible')

portion. Now, I’m wondering if because when the disclaimer is toggled, although it appears hidden, according to jQuery, it is only toggled not hidden so I need to change the

:visible

filter to a different one.

Any suggestions for filter or anything else? Also, I already know my this and .prev() references are functioning properly, because the slideToggle occurs, the button’s value however, does not.

Thanks!

UPDATE:

Figure the HTML for my test page would be useful:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>StarTrackr!</title>

  <link rel="stylesheet" href="../../css/base.css" type="text/css" media="screen" charset="utf-8" />  

  <script src="../../lib/jquery-1.4.min.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" src="script.js"></script>
</head>
<body>
  <div id="container">
    <div id="header">
      <h1>StarTrackr!</h1>
    </div>
    <div id="content">
      <h2>
        Welcome!
      </h2>
      <div id="navigation">
        <ul>
          <li><a href="#">Home</a></li>
          <li><a href="#">Buy Now!</a></li>
          <li><a href="#">About Us</a></li>
          <li><a href="#">Gift Ideas</a></li>
        </ul>
      </div>
      <p id="intro">
        Welcome to <strong>StarTrackr!</strong> the planet's premier celebrity tracking and monitoring service. Need to know where in the world the best bands, musicians or producers are within 2.2 square meters? You've come to the right place. We have a very special special on B-grade celebs this week, so hurry in!    
      </p>
      <p id="disclaimer">
        Disclaimer! This service is not intended for the those with criminal intent. Celebrities are kind of like people so their privacy should be respected.
      </p>

      <div id="news">
        <h2>Latest News</h2>
        <p>
          Which member of the seminal calypso/lectro band <em>C&amp;C Music Sweatshop</em> was spotted last night at <em>Dirt</em>, the trendy New York restaurant that serves only food caught and retrieved by the chef's own hands?
          <span class="spoiler">Yes! It's the ever-effervescent, <em>Glendatronix</em>!</span>
        </p>
        <p>Who lost their recording contract today? <span class="spoiler">The Zaxntines!</span></p>
      </div>
      <div id="celebs">
        <h2 class="heading">Our Celebrities</h2>
        <p class="info">
          We have an ever changing roster of newly chipped celebrities. But it can take as little as a week for the little critters to realise they've been tagged - so you have to be fast! 
        </p>
        <table class="data">
          <thead>
            <tr>
              <th>ID</th>
              <th>Name</th>
              <th>Occupation</th>
              <th>Approx. Location</th>
              <th>Price</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>203A</td>
              <td>Johny Stardust (<a href="bio.pdf">bio</a>)</td>
              <td>Front-man</td>
              <td>Los Angeles</td>
              <td>$39.95</td>
            </tr>
            <tr>
              <td>141B</td>
              <td>Beau Dandy (<a href="img.jpg">pic</a>,<a href="bio.pdf">bio</a>)</td>
              <td>Singer</td>
              <td>New York</td>
              <td>$39.95</td>
            </tr>
            <tr>
              <td>2031</td>
              <td>Mo' Fat (<a href="img.jpg">pic</a>)</td>
              <td>Producer</td>
              <td>New York</td>
              <td>$19.95</td>
            </tr>
            <tr>
              <td>007F</td>
              <td>Kellie Kelly (<a href="bio.pdf">bio</a>,<a href="w.doc">press</a>)</td>
              <td>Singer</td>
              <td>Omaha</td>
              <td>$11.95</td>
            </tr>
            <tr>
              <td>8A05</td>
              <td>Darth Fader (<a href="img.jpg">pic</a>)</td>
              <td>DJ</td>
              <td>London</td>
              <td>$19.95</td>
            </tr>
            <tr>
              <td>6636</td>
              <td>Glendatronix  (<a href="bio.pdf">bio</a>,<a href="w.doc">press</a>)</td>
              <td>Keytarist</td>
              <td>London</td>
              <td>$39.95</td>
            </tr>
          </tbody>
        </table>
      </div>


      <div id="comment">
        <h2>Leave a comment</h2>
        name:<br />
        <input type="text" /><br/>
        comment:<br/>
        <textarea rows="5" cols="30"></textarea>
      </div>

      <h2>Fine Print</h2>
      <p id="fine_print">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.    
      </p>

    </div>

    <div id="footer">
      <p>
        &copy; Copyright 2010 CelebriTracker Productions
      </p>
    </div>
  </div>
</body>
</html>
  • 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-16T07:00:31+00:00Added an answer on May 16, 2026 at 7:00 am

    The JavaScript function is marching on instead of waiting for slideToggle to finish so you’ll need to stick your test in the callback for the animation:

    $('<input type="button" id="toggleButton" value="Hide">')
        .insertAfter('#disclaimer')
        .click(function() {
            $(this).prev().slideToggle('slow', function() { 
    
                if($('#disclaimer').is(':visible')) {
                    $('#toggleButton').val('Hide');
                } else {
                    $('#toggleButton').val('Show');
                }
    
            });
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.