@rajat1997-pro
Posted
hey, nice code just one thing that the time period should change dynamically, for daily it should be yesterday, for weekly last week, and for monthly last month. You can achieve this functionally by comparing the button text which is clicked with strings daily, weekly and monthly. ex: $(button).on("click",function (e){ buttonText = e.target.textContent.toLower(); if (buttonText === "daily"){ $(.daily-button).text("Yesterday"); } else if(buttonText === "weekly"){ $(.weekly-button).text("Last Week"); } else if(buttonText=== "monthly"){ $(.monthly-button).text("Last Month"); } })
Marked as helpful
@Comet466
Posted
@rajat1997-pro thank you Rajat i didnt used jquery in this project but i do realized that i missed the detail of the previous time, the only thing that i had to add was this line of code to the forEach that runs the containers.
prev[index].textContent = "Yesterday- "+ day.daily.previous+"hrs"