javascript - How do I display the output of a countdown timer script in HTML code - e1commerce.com Ask a question New questions With the answers Unanswered Home javascript - How do I display the output of a countdown timer script in HTML code 188 votes 2 answers javascript - How do I display the output of a countdown timer script in HTML code I am trying to figure out how to display the output of this timer script I found online within another script. Here is the timer script I found:     // Set the date we're counting down to     var countDownDate = new Date("Jan 5, 2022 15:37:25").getTime();          // Update the count down every 1 second     var x = setInterval(function() {            // Get today's date and time       var now = new Date().getTime();            // Find the distance between now and the count down date       var distance = countDownDate - now;            // Time calculations for days, hours, minutes and seconds       var days = Math.floor(distance / (1000 * 60 * 60 * 24));       var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));       var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));       var seconds = Math.floor((distance % (1000 * 60)) / 1000);            // Display the result in the element with id="demo"       document.getElementById("demo").innerHTML = days + "d " + hours + "h "       + minutes + "m " + seconds + "s ";            // If the count down is finished, write some text        if (distance < 0) {         clearInterval(x);         document.getElementById("demo").innerHTML = "EXPIRED";       }     }, 1000); Copy code     <!-- Display the countdown timer in an element -->     <p id="demo"></p> Copy code Undefined asked 2022-03-14 964 votes Answer Solution: Alright so I am assuming that you are using id="demo" in your "p" tag as well as "font" tag. So the former takes precedence. Just keep id="demo" here:  <div class="flash-infos">        <div class="flash-info">       <font font size = 2; ><b id="demo"></b></font> <center>     </div>       </div> Copy code And remove any other id="demo" that you have used in other parts of HTML. Notice I have removed color="white", not sure if it syncs with the default background color. Try setting a different color if white may be the case. Undefined answered 2022-03-14 Link to answer 425 votes Answer Solution: The answer is: <b id="memo"></b> Copy code Undefined answered 2022-03-14 Link to answer Source Didn't find the answer? Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free. Ask a Question Similar questions Find the answer in similar questions on our website. 992 javascript - How do I center a custom html stylesheet on my web and mobile page? 235 javascript - How Can I Append A Subscription Discount URL to the CheckOut Page on Shopify So the Discount Code Appears Automatically? 967 javascript - Trying to get the value of attribute in Shopify theme's modal code returns null 687 html - Shopify page keep refreshing after being redirected by javascript code 56 javascript - I am trying to hide form field on submitting the form and display successful message 588 javascript - How do I return the response from an asynchronous call? 978 javascript - I can't do an installment calculation with an installment fee addition in Shopify Liquid 524 javascript - Shopify Liquid how to change the source of an image regarding to a specific variant 616 javascript - Swiper Slider (Swiper 7.4.1) is "sometimes" showing second slide instead of first one 580 javascript - Shopify - Display all the images from collection list Write quick answer Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger. Latest questions: 703 php - Can you explain me the process or steps to integrate shopify channel like shiprocket or nimbuspost? 192 php - How to Create a channel integration like Shopify in my courier company portal? 731 Shopify - Override Quanity Pricing 795 ruby on rails - How to authenticate requests for RSpec tests in shopify_app gem v19+ 517 shopify - Invalid value for type in block ppPrice. Type must be defined in schema © 2021 E-mail: infot@e1commerce.com