<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<div style="width: 1000px; height: 800px; margin: 0 auto;">
<textarea id="string" type="text" name="string" style=" width: 800px; margin: 0 auto; height: 200px;"></textarea>
<p id="length" style="color: orangered; text-align: center;"></p>
</div>
<script>
$(document).ready(function(){
$('#length').empty();
// $('#string').on('change',function () {
$('#string').on('input propertychange',function () {
var input_string = $('#string').val();
var str_length = input_string.length;
$('#length').text(str_length);
});
});
</script>
</body>
</html>