Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hy,

I wrote an OnKeyup for HTML Input. It works fine in IE8 but not firing in Chrome.

Help me
Posted

This works in FF and Chrome as suggested by
this discussion

HTML
<textarea name="textarea" id="txtComments" rows="3" onkeyup='return fnMaxLength(this,"5");' style="width: 940px" ></textarea>



function fnMaxLength(field, maxChars) {

    if (field.value.length >= maxChars) {

        var object = "-More than " + maxChars + " characters have been entered.";

        //errorAlert("error", "Maximum length error", object);

        alert(object);

        return false;

    }

}
 
Share this answer
 
You can try

XML
<html>
<head>
<script type="text/javascript">
function showPLPopup(txtCtrlName,tblName)
{ alert(txtCtrlName); }
</script>

</head>
<body>

<input id="txtPatientSrch" runat="server" maxlength="100" onkeypress="return showPLPopup('txtPatientSrch','tblMasterPatientList');" />

</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900