From 1fefc625777990a5a849f0a0d61e754aba1a77db Mon Sep 17 00:00:00 2001 From: Vinay8git Date: Fri, 11 Oct 2024 21:31:42 +0530 Subject: [PATCH] Added Telegram Clone --- Telegram/index.html | 34 ++++++++++++++++++++++++++++++++++ Telegram/script.js | 17 +++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Telegram/index.html create mode 100644 Telegram/script.js diff --git a/Telegram/index.html b/Telegram/index.html new file mode 100644 index 0000000..b7c7205 --- /dev/null +++ b/Telegram/index.html @@ -0,0 +1,34 @@ + + + + + + + Telegram UI Clone + + +
+

Chats

+
+
John Doe
+
Jane Smith
+
Group Chat
+
+
+ +
+
+

Chat with John Doe

+
+ +
+
+
+ + +
+
+ + + + diff --git a/Telegram/script.js b/Telegram/script.js new file mode 100644 index 0000000..9e41a02 --- /dev/null +++ b/Telegram/script.js @@ -0,0 +1,17 @@ +document.getElementById('send-button').addEventListener('click', function() { + const input = document.getElementById('message-input'); + const message = input.value; + + if (message.trim() === '') { + return; // Don't send empty messages + } + + const messagesContainer = document.getElementById('messages'); + const newMessage = document.createElement('div'); + newMessage.className = 'bg-blue-100 p-2 my-1 rounded-lg'; + newMessage.innerText = message; + + messagesContainer.appendChild(newMessage); + input.value = ''; // Clear the input + messagesContainer.scrollTop = messagesContainer.scrollHeight; // Scroll to the bottom +});