Skip to content

Commit

Permalink
select all and save to session
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperordrup committed Jan 24, 2025
1 parent 12b4270 commit 0a43aee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions weekdays.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ <h3>Friday</h3>
const dropdown = document.getElementById('nameDropdown');
distinctNames.forEach((name) => {
const option = document.createElement('option');
if(name === '' || name === null) {
return;
}
option.value = name;
option.textContent = name;
dropdown.appendChild(option);
Expand All @@ -455,11 +458,19 @@ <h3>Friday</h3>
const selectedName = event.target.value;
console.log('Selected:', selectedName);
window.currentAssigned = selectedName;
sessionStorage.setItem('lastSelectedName', selectedName);
if(selectedName === '') {
window.currentAssigned = null;
}
runthis(window.currentStartDay, window.currentAssigned);
}

// Attach event listener
dropdown.addEventListener('change', handleChange);
const lastSelectedName = sessionStorage.getItem('lastSelectedName');
if (lastSelectedName) {
dropdown.value = lastSelectedName;
}

function getUniqueAssignedValues(entries) {
const assignedValues = entries.map((entry) => entry.assigned); // Extract assigned values
Expand Down

0 comments on commit 0a43aee

Please sign in to comment.