Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Javascript - Count Down Character Limit on Field
SUBMITTED BY:
Guest
DATE:
July 23, 2013, 6:16 p.m.
FORMAT:
JavaScript
SIZE:
719 Bytes
Raw
Download
Tweet
HITS:
1148
Go to comments
Report
<
html
>
<
head
>
<
title
><
/title>
<
script
>
var
count
=
125
;
function
limiter
()
{
var
tex
=
document
.
getElementById
(
"comment"
).
value
;
var
len
=
tex
.
length
;
if
(
len
>
count
)
{
tex
=
tex
.
substring
(
0
,
count
);
document
.
getElementById
(
"comment"
).
value
=
tex
;
return
false
;
}
document
.
getElementById
(
"charLeft"
).
innerHTML
=
count
-
len
;
}
<
/script>
<
/head>
<
body
>
<
textarea
id
=
"comment"
onkeyup
=
"limiter()"
><
/textarea><br>
<
span
id
=
charLeft
>
125
<
/span> charachers left
<
/body>
<
/html>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus