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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:54:39+00:00 2026-06-13T20:54:39+00:00

<div id=facts> <p>notes:</p><span class=hide>note 1</span> <span class=hide>note 2</span> <span class=hide>note 3</span> <span class=hide>note 4</span>

  • 0
<div id="facts">
<p>notes:</p><span class="hide">note 1</span>
             <span class="hide">note 2</span>
             <span class="hide">note 3</span>
             <span class="hide">note 4</span>
</div>

I’m trying to make a simple ‘slideshow’ looping cycle that shows only one span to the right of the ‘fact:’ at a time but I can’t seem to figure out how to get it to work properly.

.hide {
    display: none;
}

.show {
    display: inline;
}

I’m thinking you could just add/remove classes using jquery?

  • 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-13T20:54:43+00:00Added an answer on June 13, 2026 at 8:54 pm

    Using jQuery .hide(), you can first hide all of them. Then increment a variable on click, and compare its value to % 4 where 4 is the total number of available spans. Unhide the :eq() for the variable’s current value.

    $(document).ready(function() {
        var current = 0;
    
        // This is bound to the onclick, but you can attach it to any event.
        $('#facts').click(function() {
          // Hide all of them
          $('#facts span').hide();
          // Unhide the current one:
          $('#facts span:eq(' + (current % 4) + ')').show();
          // Increment the variable;
          current++;
        });
    });
    

    ​
    Here is a live demo

    Note that if the number of child <span> varies, you would want to use $('#facts span').length as the modulo % comparison rather than the hard-coded 4 as in:

    $('#facts span:eq(' + (current % $('#facts span').length) + ')').show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am calling a page that returns data like: <div id=class> <option>Value</option> <option>Value</option> </div>
Example Div: <div class=container> <div class=select1></div> <div class=select2></div> <div class=select3></div> </div> Now I want
the div on website below that have search at the bottom and it always
struct Div { int i; int j; }; class A { public: A(); Div&
My div with class name 'header-body-right' doesn't seem to be floating to the left
Say, an HTML file contains the following elements: <div class=mydiv> <img src=img.jpg/> </div> I
I've a simple flash application that does counting on button click. I load it
I'm trying to find a jQuery selector that will match only the element that
I've been trying to call a function that appends html tags inside of pre-existing
Two important facts: This is what I mean by 'out of position': The div

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.