Contar carácteres de un textarea |
Post Reply |
Author | |
Programador
Expert@ Joined: 09 Mayo 2009 Location: San Pedro Alc. Status: Offline Points: 54 |
Post Options
Thanks(0)
Posted: 28 Febrero 2011 at 11:55am |
Insertar primero la función entre <head> y </head>:
function characterCounter(charNoBox, textFeild) {
document.getElementById(charNoBox).value = document.getElementById(textFeild).value.length; } Ahora inserta el cuadro de texarea en el lugar donde quieras:
<textarea name="textarea" cols="90" rows="15" onKeyDown="characterCounter('sigChars', 'textarea');" onKeyUp="characterCounter('sigChars', 'textarea');" id="textarea"></textarea>
Y por último coloca este campo que es el que te mostrará la suma de los carácteres escritos en el texarea:
<input name="sigChars" id="sigChars" value="0" size="3" maxlength="3" readonly="readonly" />
|
|
Sponsored Links | |
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You can vote in polls in this forum |