• 0
Sign in to follow this  
rafaelr

Limitar Textarea Funciona No Ie Mas Não Funciona No Firefox

Question

Preciso limitar o número de caracteres de um textarea em um form.

<script language="JavaScript" type="text/javascript">

function limita()

{

var txt = new String(frm.txtComentario.value);

if (txt.length > 5)

{

alert('Digite no máximo 5 caracteres');

return false;

}

}

</script>

<form name="frm" method="post" action="comenta.asp" onSubmit="return validaComentario()">

<textarea name="txtComentario" onkeypress="return limita()"></textarea>

</form>

Este simples exemplo funciona no Internet Explorer, porém o Firefox ignora. alguém sabe como fazer funcionar no Firefox?

Abraço a todos!

Rafael

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Um dica: instale a extensão firebug no Firefox e ative ela. Execute sua página e veja o que ela vai retornar de erro.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this