I have a textarea text box and a viewable p area which displays the input.
I am trying to control the the amount of text input based on p height or textarea max string length.
There are 2 issues im facing:
1) Once p goes beyond max height or textarea gets max length, textarea should stop accepting input.
2) After the max from above happens, pressing backspace or delete in textarea does not change p.
here is my fiddle
edit: this helps with part 1 but had to use keydown (textarea stops accepting input), but then hitting backspace still does not reflect on p
if (this.value.length == max || height>50) {
e.preventDefault();
} else if (this.value.length > max) {
// Maximum exceeded
this.value = this.value.substring(0, max);
}else{
recField.html(this.value);
height = recField.height()
$('.temp').text(height);
}
after more tests, keydown has issues, p does not reflect input from textarea like keyup does.
: (
back to square 1