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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:24:41+00:00 2026-06-13T05:24:41+00:00

Hello eveyone I’m trying to using click function.When user clicks the button, second text

  • 0

Hello eveyone I’m trying to using click function.When user clicks the button, second text will appear and the first one will be display none and then user click again the same button this time third text will appear and the second text will be display and finally click the same button again fourth text will appear third one display none. Here is my function:

$("#slider1next").click(function () {
    $(".text").css('display', '');
    $("#first_one").css('display','none');                   
});

here is the HTML

  <button id="slider1next" >Clickme</button>
  <p class="text" id="first_one">This is the first text</p>
  <p class="text" id="second_one" style="display:none">This is the second text</p>
  <p class="text" id="third_one" style="display:none">This is the third text</p>
  <p class="text" id="fourth_one" style="display:none">This is the four text</p>​

Also you can see there http://jsfiddle.net/ganymedes/7kxAE/

  • 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-13T05:24:42+00:00Added an answer on June 13, 2026 at 5:24 am
    $("#slider1next").click(function () {
        $(".text:visible").hide().next().show();
    });
    

    In other words, with every click, you hide the :visible text, and show the next one.

    DEMO.

    If you want to cycle back to the first one when you reach the last p, use the following instead:

    $("#slider1next").click(function () {
        var $next = $(".text:visible").hide().next();
        $next.length ? $next.show() : $(".text:first").show();
    });
    

    DEMO.
    ​

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

Sidebar

Related Questions

Hello eveyone I'm trying to using click function. When the user clicks the button,
Hello everyone this is my first post on stack overflow.com I am trying to
hello everyone I am trying to make a script that steps through a list
Hello everyone I am trying to resize an image of 700kb with imagecreatefromjpeg. This
hello everyone im trying to create this tweak that copies a file from one
Hello everyone. I'm using Silverlight webbrowser control, and I'm having some problems with that.
Hello everyone i need some help. I'm trying to make an application for mac
Hello everyone I am just learning my first programming language and have just corrected
Hello everyone, I am using hibernate ORM and oracle database. My cfg file has
Hello everyone I have a question... I'm trying to make my sms faker app,

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.