I am currently in the process of developing a reminder application, but I am facing an issue with storing the date and time information. As of now, I can only save the name and description of the reminders. My immediate goal is to successfully save this data into local storage and tackle the retrieval aspect later on.
let reminders = [];
const addReminders = (ev) => {
ev.preventDefault();
let reminder = {
ReminderInput: document.getElementById('ReminderInput').value,
InfoInput: document.getElementById('InfoInput').value
}
localStorage.setItem('ReminderInput', JSON.stringify(ReminderInput));
localStorage.setItem('InfoInput', JSON.stringify(InfoInput));
localStorage.setItem('DateInput' JSON.stringify(DateInput));
}
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('btn').addEventListener('click', addReminders);
});
<form id="todoForm">
<label for="ReminderInput">Reminder</label>
<input class="u-full-width" type="text" id="ReminderInput">
<label for="DateInput">Date</label>
<input class="u-full-width" type="datetime-local" id="DateInput">
<label for="InfoInput">Additional Information</label>
<textarea class="u-full-width" type="text" placeholder="Remember to..." id="InfoInput"></textarea>
<button type="button" id="btn" class="button-primary">Add Reminder</button>
</form>