Picnic Website Code Tutorials

Maximum Textarea Characters Tutorial

View Demo

Place this script just above the closing body tag.

<script type="text/JavaScript">
function limitText(textArea, length) {
    if (textArea.value.length > length) {
        textArea.value = textArea.value.substr(0,length);
    }
}
</script>
		

Place onKeyPress="limitText(this,20);" in the textarea tag so it looks like the snippit below. Change the value to suit.

<textarea onKeyPress="limitText(this,20);"></textarea>
		

Sponsors

Top Donators

Friends of Mine