drmoustafaamin's picture
create an application to the iphone to write notes
9439136 verified
Raw History Blame Contribute Delete
980 Bytes
document.addEventListener('DOMContentLoaded', () => {
// Initialize note functionality
const textarea = document.querySelector('textarea');
const titleInput = document.querySelector('input[type="text"]');
// Auto-focus the title field on page load
titleInput.focus();
// Save note functionality
const saveNote = () => {
const note = {
title: titleInput.value,
content: textarea.value,
createdAt: new Date().toISOString()
};
// In a real app, you would save to localStorage or a database
console.log('Note saved:', note);
};
// Add event listeners for saving
document.querySelector('button:text("Done")').addEventListener('click', saveNote);
// Handle keyboard shortcuts
document.addEventListener('keydown', (e) => {
if (e.metaKey && e.key === 's') {
e.preventDefault();
saveNote();
}
});
});