Created
October 4, 2019 22:41
-
-
Save TopRoupi/9777299c04a80bce75ca46f27e0eaba6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submit_messages(){ | |
$('#message_content').on('keydown', (event) => { | |
if(event.keyCode === 13){ | |
$('input').click(); | |
event.target.value = ''; | |
} | |
}) | |
} |
tente colocar e.preventDefault() antes do if
function submit_messages() {
// pega o button submit
const msg = document.querySelector('seubutton');// pega o input const input = document.querySelector('seuinput'); msg.addEventListener('keydown', (e) => { e.preventDefault(); if(e.keyCode === 13){ input.value = ''; } })
}
submit_messages()
vou testar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function submit_messages() {
// pega o button submit
const msg = document.querySelector('seubutton');
}
submit_messages()