<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script>
window.addEventListener('DOMContentLoaded', function() {
var inp = document.querySelectorAll('[name="count"]');
[].forEach.call(document.querySelectorAll('textarea'), function(area, i) {
var count = inp[i], limit = count.value;
area.addEventListener('input', function() {
area.value = area.value.substring(0, limit);
count.value = limit - area.value.length;
});
});
});
</script>
</head>
<body>
<textarea></textarea>
<input readonly type="text" name="count" size="3" value="100"> осталось символов<br>
<textarea></textarea>
<input readonly type="text" name="count" size="3" value="100"> осталось символов<br>
<textarea></textarea>
<input readonly type="text" name="count" size="3" value="100"> осталось символов<br>
<textarea></textarea>
<input readonly type="text" name="count" size="3" value="100"> осталось символов<br>
</body>
</html>