sthig Posted October 11, 2019 Share Posted October 11, 2019 I have made a code block that has a daily count up javascript in it It works just fine however it's not bringing over the native CSS into it and I'm not sure what I'm supposed to do here at this juncture. Here is the code <h1 id="andrewrox" data-behavior="daysSince">¯\_(ツ)_/¯</h1> <h1>Consecutive days</h1> <script> // To set two dates to two variables var date1 = new Date("01/01/2019"); var date2 = new Date(); // To calculate the time difference of two dates var Difference_In_Time = date2.getTime() - date1.getTime(); // To calculate the no. of days between two dates var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24); //To display the final no. of days (result) document.querySelector('[data-behavior="daysSince"]').innerHTML = Math.round(Difference_In_Days) </script> here are the two screenshots showing the native CSS then when you preview it, there is no CSS applied Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.