Hi
I have a text area and a label.
label(cntfieldld) represents the number of characters that still can be entered in the text area(xtxExpertise).
I have written the following code:
function textCounter (txtExpertiseId, cntfieldId, maxlimit)
{
Count = cntfieldId.value;
If (txtExpertiseId.value.length > 2000)
cntfieldId.value=0
else
cntfieldId.value = maxlimit - txtExpertiseId.value.length;
if (txtExpertiseId.value.length > maxlimit) // if too long...trim it!
{
ab= window.confirm (" Please enter fewer than 2000 characters");
if (ab == true )
txtExpertiseId.value = txtExpertiseId.value.substring (0, maxlimit);
else
txtExpertiseId.value = txtExpertiseId.value.substring (0, maxlimit-count);
}
}
The code is working fine but i am getting a problem when i overwrite(by pasting) the contents of the textarea , two events are getting invoked-onkeyPress and onPaste events.
Can anyone help me to resolve this....
Thanks in advance