Problem with keyPress in Mozilla
- by sudhansu
I am usingtextarea to get some inputs. A label shows the updated chars left.
It works fine in IE, but in FF 3.0, after reaching the max limit, it doesn't allow to delete or backspace key.
I am using a javascript function on keypress event of the textarea.
the javascript code is
function checkLength()
{
var opinion = document.getElementById('opinion').value;
if(opinion.length > 50)
alert("You have reached the mas limit.");
else
document.getElementById('limit').innerHTML = 50 - opinion.length;
}
while on the page, i am using this
<label id="limit">50 </label>
<textarea id="opTxtArea" onkeypress="javascript:checkLength();"></textarea>
Everything is working fine. The problem arises in FF, when the inputs reach the max limit, the message is displayed, but it doesn't allow to delete or backspace.