below is the js function that I have created on the page:

```
<script type="text/javascript">
    function maxLength(field, maxChars) {
        if (field.value.length >= maxChars) {
            event.returnValue = false;
            return false;
        }
    }

</script>

```

and this is the textarea for which I am calling this function :

```
<textarea id="txtapproverremarks" cols="20" rows="2" runat="server" style="width: 600px"
                                                            onkeypress="javascript:return maxLength(this,'50');"></textarea>

```

The things are working fine on IE7/8/9 but giving below error in IE 10 & IE 11 :

```
JavaScript runtime error: Function expected

```

Anyone have any idea, why this is happening.

Thanks in advance.