The problem is that Firefox counts newline as \"1\"(\\n) character while Chrome count them as \"2\"(\\r\\n)
This is what I get in a t
I didnt find any solution to make the maxlength atribute to work the same way in all browsers, and I think is because its relative new. So I decided to go for javascript.
Googling a little I found this jQuery Max Length plugin that works great just adding a few lines. Is available under the MIT licence. And counts newlines as it should be (2 characters)
It has some parameters to set the maxlength, feedback text, background change when full, between others. The website has very good documentation and a lot of examples.
It's highly customisable, for example here is mine
This is the only code I used plus some css.
<script type="text/javascript" src="jquery.plugin.js"></script>
<script type="text/javascript" src="jquery.maxlength.js"></script>
<script>
$(function() {
$('.t_tresc').maxlength({
showFeedback: true,
feedbackText: '{c} / {m} max.',
overflowText: '{c} / {m} max!',
feedbackTarget: '#targetFeedback$name',
max: $max_length,
truncate: false,
onFull: null
});
});
</script>