chitika

Tuesday, September 20, 2011

html: how to limit text field char, text box char, textarea character

This site provides users with the information about html: how to limit text field characters, limit textarea characters, how to limit text box characters in html, how to check characters in text field, textarea, example, and more.

If you think that this site is helpful, please recommend your friends to visit our site.


How to limit text field, text box, textarea characters in html

For limiting text field, text box, textarea characters in html, you need to add a little javascript code. The following is an example for how to limit text field, text box, textarea characters in html.


--------------------------------------------------------------------------------
< script>
function checkchars(cur)
{
var maxlength=50
if (cur.chars.value.length>maxlength){
alert("Please limit your input to 50 or less characters!")
return false
}
}
//-->
< /script>

< form onsubmit="return checkchars(this)">
Please type a title of webpage within 50 chars or less:
< br>
< input type="text" size="68" name="chars" >
< br>
< input type="submit" value="Submit!">
< /form>

< form onsubmit="return checkchars(this)">
Please type a description of webpage within 50 chars or less:
< br>
< textarea rows="5" cols="58" name="chars">
< br>
< input type="submit" value="Submit!">
< /form>

No comments:

Post a Comment

For other hundreds of computer repair tips, tricks, tweaks, guide, help, please go to


http://website.edusoftmax.com