Cannot get document.getElementByID to work

Posted by user1804234 on Stack Overflow See other posts from Stack Overflow or by user1804234
Published on 2012-11-29T18:48:18Z Indexed on 2012/12/02 5:05 UTC
Read the original article Hit count: 117

Filed under:
|

The following function doesn't work for some reason. Can someone see what the problem is?

function checkMaxLen(txt, maxLen) {
    var actualLen = txt.value.length;
    var remain = maxLen - actualLen;
    document.getElementById('remainChar').Value = remain;
}

<input type="text" id="remainChar" runat="server" value="500"/>

Whenever I try to run the function, I get this error:

Microsoft JScript runtime error: Unable to set value of the property 'Value': object is null or undefined

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET