Problem with keyPress in Mozilla
Posted
by sudhansu
on Stack Overflow
See other posts from Stack Overflow
or by sudhansu
Published on 2010-04-13T07:02:03Z
Indexed on
2010/04/13
7:13 UTC
Read the original article
Hit count: 290
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.
© Stack Overflow or respective owner