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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:53:40+00:00 2026-05-16T06:53:40+00:00

Hey guys, I have a bit of a problem that I can’t solve. I’m

  • 0

Hey guys, I have a bit of a problem that I can’t solve. I’m don’t know much about jquery, so i’m hoping you can help me.

Basically I have a quiz script that has questions in divs, I want when a person checks radiobox and presses “next question” button, the present div would fade out, and the next div would fade in.
Here’s how html code looks like:

    <div id="questions">
    <div id="question0" class="question">
    <span style="verhnij">Title</span> 
    <li><input type="radio" name="q_0" value="0"> 0</li>
     <li><input type="radio" name="q_0" value="2">2</li>
     <li><input type="radio" name="q_0" value="1">1</li> 
    <a href="" onclick="javascript: transition(0);">Next</a>
    </div>
    <div id="question1" class="question">
    <span style="verhnij">Title</span> 
    <li><input type="radio" name="q_1" value="2">2</li>
     <li><input type="radio" name="q_1" value="0">0</li>
     <li><input type="radio" name="q_1" value="1">1</li> 
   <a href="" onclick="javascript: transition(1);">Next</a>
    </div>
    <div id="question2" class="question">
    <span style="verhnij">Title</span> 
    <li><input type="radio" name="q_2" value="1">1</li> 
    <li><input type="radio" name="q_2" value="2">2</li> 
    <li><input type="radio" name="q_2" value="0">0</li> 
  <a href="" onclick="javascript: transition(2);">Next</a>
    </div>

Each Question Div has a unique id and the same class.

Here is some of javascript.

$('#questions').ready(function(){

    for (i = 1; i < 100; i++) {
      if ($('#question' + i).length > 0) {
            $('#question' + i).hide();

  } else {
            break;
        }

  }



});

function transition(question_id) {
    $('#question' + question_id).fadeOut('fast',function() {

           question_id++;
        if ($('#question' + question_id).length > 0) {
           $('#question' + question_id).fadeIn('fast');
        } else {
            Here will be Form submit
  }
    });
}    

The problem with this script is that after I press next, it fadesOut and FadesIn good, and then the ready function overwrites everything and again question 0 pops out.
Help really appreciated.

Thank you.

  • 1 1 Answer
  • 3 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-16T06:53:41+00:00Added an answer on May 16, 2026 at 6:53 am

    You need to prevent the page from reloading when you click the link otherwise you restart the whole thing again : since you’re using a “a” tag, you need to:

    1) add # as href attribute instead of nothing (href="#").

    2) return false from your transition function:

    function transition(question_id) {
        $('#question' + question_id).fadeOut('fast', function() {
            question_id++;
            if ($('#question' + question_id).length > 0) {
                $('#question' + question_id).fadeIn('fast');
            } else {}
        });
        return false;
    }
    

    (sorry for the format, i just edited my post 10 times but to no avail)

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

Sidebar

Related Questions

Hey guys, I have this quick bit of code that I can't figure out
Hey guys, I have a bit of a weird problem. I have a jquery
Hey guys am having a bit of problems with my jQuery, I have all
Hey guys I have an ajax jquery function that receives data from a php
Hey guys I have an older site that is coded in AS2(I can't get
Hey guys i have a problem in reffering a library on eclipse. Dont know
Hey guys i have a problem. I have a listview that is dynamically filled.
Hey guys, I have a bit of a problem. I get values from textarea
Hey guys i have looked as much as i could and i could not
Hey guys I have an admin page that checks if you are admin before

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.