I'm having problems with my application because I have two types of textarea on the same page. One creates the post and the other creates the comment for this post.
The following code submits the post textarea:
document.onkeyup=function(e){
if(e.which == 13){
if(document.getElementById('textarea-post').value == ""){
} else {
document.enviaPost.submit();
}
}
}
Code form above:
<form action="posta.php" method="post" name="enviaPost">
<ul class="form-post" >
<li>
<input type="hidden" name="data" value="<?= date("Y/m/d") ?>" />
<textarea placeholder="Como você está se sentindo?" name="contpost" id="textarea-post" /></textarea>
</li>
<input type="submit" value="Enviar" class="botao-enviar-post" />
</ul>
What I would like to know is if, if I put another keyup like this pro textarea of the comment, it will cause some conflict. And if you give, I'd like to know how you can do this without generating a conflict.
Second textarea:
<form action="init/add_coment.php" method="post" name="enviaComent">
<input type="hidden" value="<?=$post['id']?>" name="id_post" />
<textarea id="texto_coment" name="comentario" class="comentario-texto" placeholder="Escreva um comentário..."></textarea>
</form>