| <script> | |
| const chatbotMessages = document.querySelector('.chatbot-messages'); | |
| const chatbotInput = document.querySelector('.chatbot-input input'); | |
| const chatbotButton = document.querySelector('.chatbot-input button'); | |
| chatbotButton.addEventListener('click', () => { | |
| const userMessage = chatbotInput.value; | |
| const botMessage = 'Hey alles fresh?'; | |
| const message = ` | |
| <div class="chatbot-message"> | |
| <span class="user">You:</span> | |
| <span>${userMessage}</span> | |
| </div> | |
| <div class="chatbot-message"> | |
| <span class="bot">Bot:</span> | |
| <span>${botMessage}</span> | |
| </div> | |
| `; | |
| chatbotMessages.insertAdjacentHTML('beforeend', message); | |
| chatbotInput.value = ''; | |
| }); | |
| </script> | |