/    Sign up×
Community /Pin to ProfileBookmark

Placing Character Limits on Text

I would like to place a character limit on the amount of text being typed. I would like an error to pop-up when the limit has been hit as well as not allowing anymore characters to be typed even when the user is typing. I would also like to have the feature of showing the count of characters while a user is typing.

Can anyone help me with the javascript code.

Matt

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JAug 19.2005 — Take a look here, this may help you out

www.huntingground.freeserve.co.uk/scripts/type_effects.htm
Copy linkTweet thisAlerts:
@webcommunic8orauthorAug 22.2005 — Thank's Mr J that helps a bit, bit i still need help with creating a pop-up error/warning when the max number of characters have been obtained.

Thank you - a really novice javascripter
Copy linkTweet thisAlerts:
@Alon_C_Aug 22.2005 — Check this one:

[CODE]<html>
<!-- Created on: 22/08/2005 -->
<head>
<title></title>
</head>
<body>
<form name=y>
<script>
function ck(l){document.y.x.value=l+1;}
</script>
&nbsp;&nbsp;The length: <input type=text size=1 name='x'><br>
String input: <input type=text size=9 maxlength=9 onkeydown="ck(this.value.length);" onchange ="javascript:if(this.value.length>8)alert('String too Longnn[Only 8 Char Allowed]')">
</form>
</body>
</html>[/CODE]
×

Success!

Help @webcommunic8or spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...