Hi All,
The Multi-line text field for custom list has more than 63000 character. Is there a way to limit it using Jquery?
I am using script editor web-part to embed the jquery.
I have the code below, please advice.
description is the column internal name.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script>
$(document).ready(function () {
var maxLength = 400;
$("textarea[id*=description]").attr('maxlength', maxLength);
$("textarea[id*=description]").on('keydown keyup change', function () {
var char = $(this).val();
var charLength = $(this).val().length;
var Text = charLength + ' of Maximum ' + maxLength + " characters allowed.";
if (charLength >= 250 && charLength <= 350) {
Text = "<font color='blue'>" + Text + "</font>";
}
if (charLength > 1950) {
Text = "<font color='red'>" + Text + "</font>";
}
$("span[class='ms-metadata']").html(Text);
});
});
</script>
Thanks,
Abenet