html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notes App</title>
<link rel="style-sheet" href="styles.css"></link>
</head>
<body>
<div class="container">
<h1>NOTES APP</h1>
<div class="new-note">
<input type="text" id="noteInput" placeholder="Type a new note..." />
<button onclick="addNote()">Add Note</button>
</div>
<ul class="notes" id="notesList"></ul>
</div>
</body>
<script src="script.js"></script>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #ADD8E6;
.container {
width: 90%;
max-width: 600px;
background: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
h1 {
text-align: center;
color: #333;
}
.new-note {
display: flex;
margin-bottom: 20px;
}
.new-note input {
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// JavaScript code for functionality of the Notes App
const notesList = document.getElementById("notesList");
const noteInput = document.getElementById("noteInput");
// Load saved notes from localStorage
let notes = JSON.parse(localStorage.getItem("notes")) || [];
function renderNotes() {
notesList.innerHTML = ""; // Clear the list
notes.forEach((note, index) => {
const noteItem = document.createElement("li");
noteItem.className = "note";
const noteText = document.createElement("span");
noteText.className = "note-text";
noteText.textContent = note;
// Edit button
const editButton = document.createElement("button");
editButton.className = "edit-btn";
editButton.textContent = "Edit";
editButton.onclick = () => editNote(index);
// Delete button
const deleteButton = document.createElement("button");
deleteButton.className = "delete-btn";
deleteButton.textContent = "Delete";
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run