100-project-100-days-website/100_projects/61-a-message-to-pass/main.js
2023-04-23 17:40:22 +03:00
Ask

22 lines
605 B
JavaScript

{6ed4f2f7cf7b6408fc962e99a3cedbb8ea05eeda true 605 main.js 0xc0030cae00}

(function(){
const form = document.querySelector('#message-form');
form.addEventListener('submit', function(e){
e.preventDefault()
const message = document.querySelector('#message');
const feedback = document.querySelector('.feedback');
const messageContent = document.querySelector('.message-content');
if(message.value === ''){
feedback.classList.add('show');
setTimeout(function(){
feedback.classList.remove('show')
}, 4000)
} else{
messageContent.textContent = message.value;
message.value = ''
}
})
})()