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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:50:44+00:00 2026-06-15T10:50:44+00:00

I am looking to have 3 different divs displayed 1 div on the 1st

  • 0

I am looking to have 3 different divs displayed
1 div on the 1st visit
2nd div on the 2nd visit
3rd div on the 3rd visit

I thought I had the code to make this happen but it is not working and I am having trouble figuring out what I’m doing wrong.

$(document).ready(function() { 

    var cookieRCCS = $.cookie('shownDialog');

    console.log(cookieRCCS);

     // Check if the cookie exists.
    if ( cookieRCCS === null ) {
        console.log("1st if statement " + cookieRCCS);
        $("#hellopanel1").show();

        // set the cookie to value 1
        $.cookie('shownDialog', '1', {expires: 7});

    } 
    else if ( cookieRCCS === 1 ) {
        console.log("2nd if statement " + cookieRCCS);      
        $("#hellopanel2").show();

        // If the cookie exists, take the value
        cookie_value = $.cookie('shownDialog');

        // Convert the value to an int to make sure
        cookie_value = parseInt(cookie_value);

        // Add 1 to the cookie_value
        cookie_value++;

         // Save the incremented value to the cookie
        $.cookie('shownDialog', cookie_value, {expires: 7});

    }
    else if ( cookieRCCS === 2){
        console.log("3rd if statement " + cookieRCCS);

        $("#hellopanel3").show();

        cookie_value = $.cookie('shownDialog');

        cookie_value = parseInt(cookie_value);

        cookie_value++;

        $.cookie('shownDialog', cookie_value, {expires: 7});
    }

    else{
        console.log("4th Time Here");
    }

});
  • 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-15T10:50:45+00:00Added an answer on June 15, 2026 at 10:50 am

    This will solve your problem witha simple and elegant case statement to properly trigger the pieces of code in a cascading fashion:

    $(document).ready(function() { 
        var cookieRCCS = (+$.cookie('shownDialog')) + 1;
        $.cookie('shownDialog', cookieRCCS,{expires: 7});
    
        console.log(cookieRCCS);
    
        switch (cookieRCCS) {
            case 1:
                console.log("1st if statement " + cookieRCCS);
                $("#hellopanel1").show();
                break;
    
            case 2:
                console.log("2nd if statement " + cookieRCCS);      
                $("#hellopanel2").show();
                break;
    
            case 3:
                console.log("3rd if statement " + cookieRCCS);
                $("#hellopanel3").show();
                break;
    
            default:
                console.log("4th+ Time Here");
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking at files that all have a different version number that starts at
I have been looking into different systems for creating a fast cache in a
I have ten buttons that each correspond to a different number. I'm looking to
I have this input text and an input button...I am looking to have them
I'm looking for the better way (aka architecture) to have different kind of DBs
I use the following code on my page: <div id=itemstable class=item_type1> ...other divs here...
I have a nested div (see below) which have different CSS classes to give
In my contact information i have a few lines looking like this. Phone: 123
I have some divs in the page that show different things of the same
I have different webpages that simulate single A4 press pages. I'm looking for a

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.