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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:42:20+00:00 2026-06-08T08:42:20+00:00

I have 3 spans <span class=input1 style=display:block;><span class=round></span></span> <span class=input2 style=display:none;><span class=round></span></span> <span class=input3

  • 0

I have 3 “span”s

<span class="input1" style="display:block;"><span class="round"></span></span>
<span class="input2" style="display:none;"><span class="round"></span></span>
<span class="input3" style="display:none;"><span class="round"></span></span>

And this is the script:

$(document).ready(function() {
    act = 1;
    next = act+1;
    });

$(".round").click(function (){
         $('.input'+act).hide();
         $('.input'+next).show();
         act = next;
    });

Push “.round” for the first time -> “.input1” – hide & “.input2” – show
If i want to push “.round” for the second time -> nothing happened. (This is the problem)

How to hide “.input2” and show “.input3”?
Thanks for help and sorry for my english!

  • 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-08T08:42:21+00:00Added an answer on June 8, 2026 at 8:42 am

    Solution

    Because next is always equal to 2.

    The second time, act == 2 and next == 2 so you hide then show the same element.

    Try that:

    $('.round').click(function (){
        $('.input' + act).hide();
        $('.input' + next).show();
        act = next++;
    });
    

    A bit of explanation

    According to MDN:

    ++ is a increment operator.

    This operator increments (adds one to) its operand and returns a
    value. If used postfix, with operator after operand (for example,
    x++), then it returns the value before incrementing. If used prefix
    with operator before operand (for example, ++x), then it returns the
    value after incrementing.

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

Sidebar

Related Questions

I have the following form declaration: <div class=edit-dialog span-10 style=display:none;> <div class=edit-message span-10 style=margin-bottom:30px;>
I have this set of code that adds a display:none css class to a
Lets assume I have several <span class='remove-type'> elements on a page. In jQuery document.ready
if i have the following links : <a href="#" onclick="return navigateTo(this)" id="menuList:0:menu" class="normalLink"> <span
I have this code <span> <%= image_tag(machinelogo.jpg, :alt => camp,:class=>logo) %></span> <ul id=css3menu1 class=topmenu>
So i have this structure <div class=accordionContent> <form action=/make_requests class=make_request method=post><div style=margin:0;padding:0;display:inline><input name=authenticity_token type=hidden
I have 2 spans. First one: <span class=body> Second one: <span class=desc> My CSS:
I have a function in javascript that changes a span class when I click
I have a span that is generated through javascript, with its css class as
I have a div with a span <div id=div1> <span class=>hello</span> </div> When i

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.