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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:00:33+00:00 2026-06-08T14:00:33+00:00

I want to close and create a new div when the countdown hits 0.

  • 0

I want to close and create a new div when the countdown hits 0. My div looks like this

<div id="bij2">Test
    <div id="bij2Blauw">
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="3" class="titel">Resterende tijd</td>
            </tr>
            <tr>
                <td height="25" colspan="3" align="center" valign="middle">
                    <input id="aktie2" type="text" class="countdownTekst" size="27" readonly="readonly">
                    <script language="javascript">
                        countdown(2012, 7, 29, 'aktie2', 'bij2')
                    </script>
                </td>
            </tr>
            <tr>
                <td height="60">
                    <input name="kopen1" type="submit" class="kopen" id="kopen1" value="Koop nu"
                    />
                </td>
                <td height="60" colspan="2" align="right" valign="bottom">
                    <span class="euro">&#8364;</span>
                    <span class="prijs">14,95</span>
                </td>
            </tr>
        </table>
    </div>
</div>

This is the countdown

function countdown(yr, m, d, idCountdown, divId) {
    var theyear = yr;
    var themonth = m;
    var theday = d;
    var today = new Date();
    var todayy = today.getYear();
    if (todayy < 1000) todayy += 1900
    var todaym = today.getMonth();
    var todayd = today.getDate();
    var todayh = today.getHours();
    var todaymin = today.getMinutes();
    var todaysec = today.getSeconds();
    var todaystring = montharray[todaym] + " " + todayd + ", " + todayy + " " + todayh + ":" + todaymin + ":" + todaysec;
    var futurestring = montharray[m - 1] + " " + d + ", " + yr;
    var dd = Date.parse(futurestring) - Date.parse(todaystring);
    var dday = Math.floor(dd / (60 * 60 * 1000 * 24) * 1);
    var dhour = Math.floor((dd % (60 * 60 * 1000 * 24)) / (60 * 60 * 1000) * 1);
    var dmin = Math.floor(((dd % (60 * 60 * 1000 * 24)) % (60 * 60 * 1000)) / (60 * 1000) * 1);
    var dsec = Math.floor((((dd % (60 * 60 * 1000 * 24)) % (60 * 60 * 1000)) % (60 * 1000)) / 1000 * 1);
    var dag = "dagen";

    if (dday <= 0 && dhour <= 0 && dmin <= 0 && dsec <= 0) {
        document.getElementById(idCountdown).value = "voorbij";
        $(document.getElementById(divId)).fadeOut(2000);
        //removeElements(document.getElementById(divId));
        setTimeout("creatediv(document.getElementById(divId))", 3000);
        return;
    } else if (dday <= 1) {
        dag = 'dag';
    }
    document.getElementById(idCountdown).value = dday + ' ' + dag + ' ' + dhour + " uur " + dmin + " min " + dsec + " sec";
    setTimeout(function () {
        countdown(theyear, themonth, theday, idCountdown);
    }, 1000);
}

So when the time is over it will fade out the div using jQuery. Then i want to create a new div. I use this:

function creatediv(id) {

    var newdiv = document.createElement('div');
    newdiv.setAttribute('id', id);
    newdiv.className = 'newclass';
    newdiv.style.float = "left";
    newdiv.innerHTML = "nothing";

    document.body.appendChild(newdiv);
    alert(id + 'gemaakt');
}

But this creates a div at the bottom of the page and i want a new one at the same position as the div that fades out. What do i need to change?

  • 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-08T14:00:36+00:00Added an answer on June 8, 2026 at 2:00 pm

    It’s really simple:

    $('#bij2').replaceWith( newcontent );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is frustrating, I want to simply create new input field inside div on
I'm creating a modal dialog like this window.NewPageModalView = Backbone.View.extend({ template: _.template($('#view-template-new-page-dialog').html()), el: $('div#main'),
I want to do something like this so I can create a modal dialog
I want to be able to create modal dialogs, with, for example close: function()
I want to close out my old question start a new one with a
I have this problem since I'm beginning in OOP programming I want to close
I suppose the title is quite self-explanatory. I want to close a div when
I have a main window, that opens another window. I want to close this
I want to create a simple form for adding new products using jqModal .
I want to create a handlebars helper that works like {{#each}} but gives me

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.