druma-davi's picture
generate a chatgpt copy, make the same desing and etc to chatgpt
819efbb verified
raw
history blame contribute delete
970 Bytes
document.addEventListener('DOMContentLoaded', function() {
// Auto-resize textarea
const textarea = document.querySelector('textarea');
textarea.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = (this.scrollHeight) + 'px';
});
// Simulate sending a message
const sendButton = document.querySelector('button[aria-label="Send message"]');
sendButton.addEventListener('click', function() {
const message = textarea.value.trim();
if (message) {
// In a real app, you would send this to your backend
console.log('Message sent:', message);
textarea.value = '';
textarea.style.height = '60px';
}
});
// Handle Enter key press
textarea.addEventListener('keydown', function(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
sendButton.click();
}
});
});