Show A Different Div For Each Day Of The Week
Utility
JS
- Apply attribute name of data-week-list to your list containing 7 items
- The first item within the list should be for Sunday
- A different div will be shown for each day of the week
<script>
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("[data-week-list]").forEach(list => {
const currentDay = new Date().getDay();
const items = Array.from(list.children);
const currentItem = items[currentDay];
items.forEach(item => {
if (item !== currentItem) item.remove();
});
});
});
</script>Preview Links
Custom JS
Enable custom code in preview or view on published site.
Enable custom code?
Last Updated: Dec 4, 2025
- Apply attribute name of data-week-list to your list containing 7 items
- The first item within the list should be for Sunday
- A different div will be shown for each day of the week
<script>
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("[data-week-list]").forEach(list => {
const currentDay = new Date().getDay();
const items = Array.from(list.children);
const currentItem = items[currentDay];
items.forEach(item => {
if (item !== currentItem) item.remove();
});
});
});
</script>