Use focus, keydown and keyup event. when users type a text field then we will look at which line is writing and how many letters are written. if line length and character length are over we will not be able to type in the text field.


<!DOCTYPE html>
<html lang="en">
        <title>PHP Tutorial</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="">
        <script src=""></script>
        <script src=""></script>
            $(function() {
                var maxLength = 30;
                var mawRow = 4;
                $('#txtDes').on('input focus keydown keyup', function() {
                    var text = $(this).val();
                    var lines = text.split("

                    for (var i = 0; i < lines.length; i++) {
                        if (lines[i].length > maxLength) {
                            lines[i] = lines[i].substring(0, maxLength);
                    while (lines.length > mawRow) {
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="form-group">
                        <label for="txtDes">Message:</label>
                        <textarea class="form-control" id="txtDes" name="txtDes"></textarea>


Limit The Number Of Characters Per Line In Textarea Using Jquery