Within the cells of my calendar are placeholders for events, dates, participants, and descriptions. Now, I am looking to populate these placeholders with data previously stored using localStorage.
Unfortunately, my current code is not achieving this. How can I make it work?
To accomplish this task, I have created a JSON object that serves as an array. Each element in the array corresponds to a specific day on the calendar. I am targeting the cell (thisCell) that I click on in order to retrieve the relevant stored information.
var organizer = [
//February 9, 2015
{thisCell.getElementsByClassName("spanEvent")[0].value: JSON.parse(localStorage.getItem("event")),
thisCell.getElementsByClassName("spanDate")[0].value: JSON.parse(localStorage.getItem("date")),
thisCell.getElementsByClassName("spanParticipants")[0].value: JSON.parse(localStorage.getItem("participants")),
thisCell.getElementsByClassName("spanDescription")[0].value: JSON.parse(localStorage.getItem("description"))
},
//July 22, 2016
{thisCell.getElementsByClassName("spanEvent")[0].value: JSON.parse(localStorage.getItem("event")),
thisCell.getElementsByClassName("spanDate")[0].value: JSON.parse(localStorage.getItem("date")),
thisCell.getElementsByClassName("spanParticipants")[0].value: JSON.parse(localStorage.getItem("participants")),
thisCell.getElementsByClassName("spanDescription")[0].value: JSON.parse(localStorage.getItem("description"))
}
];