Add practical examples to multiple files
- LF9-03 Virtualisierung: Docker Compose + Volume examples - LF6-02 Frontend: To-Do list practical example - LF8-04 ETL: Complete ETL pipeline example - LF6-04 Sicherheit: Express.js security headers - LF2-04 Nutzwertanalyse: Cloud provider selection example - LF9-04 Monitoring: Prometheus alerts + Python logging
This commit is contained in:
@@ -99,6 +99,45 @@ element.setAttribute("class", "neu");
|
||||
element.getAttribute("href");
|
||||
```
|
||||
|
||||
### Praktisches Beispiel: To-Do-Liste
|
||||
|
||||
```html
|
||||
<!-- HTML -->
|
||||
<input type="text" id="todo-input" placeholder="Neue Aufgabe">
|
||||
<button id="add-btn">Hinzufügen</button>
|
||||
<ul id="todo-list"></ul>
|
||||
```
|
||||
|
||||
```javascript
|
||||
// JavaScript
|
||||
const input = document.getElementById('todo-input');
|
||||
const button = document.getElementById('add-btn');
|
||||
const list = document.getElementById('todo-list');
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
const text = input.value.trim();
|
||||
if (text) {
|
||||
// Neues Element erstellen
|
||||
const li = document.createElement('li');
|
||||
li.textContent = text;
|
||||
|
||||
// Löschen-Button
|
||||
const deleteBtn = document.createElement('button');
|
||||
deleteBtn.textContent = 'X';
|
||||
deleteBtn.onclick = () => li.remove();
|
||||
|
||||
li.appendChild(deleteBtn);
|
||||
list.appendChild(li);
|
||||
input.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
// Enter-Taste Support
|
||||
input.addEventListener('keypress', (e) => {
|
||||
if (e.key === 'Enter') button.click();
|
||||
});
|
||||
```
|
||||
|
||||
### Events
|
||||
|
||||
```javascript
|
||||
|
||||
Reference in New Issue
Block a user