Snippet. Limit Amount of Entered Text into TextArea

This script shows how to limit the amount of text that a user is allowed to enter into a textarea using JQuery.

    <textarea maxlength="150" onkeyup="var val = $(this).val(); if(val.length>150){$(this).val(val.substr(0,150));}"></textarea>

Updated on: 23 Nov 2024