If you are not using the var
keyword, the IE browser looks for messageLength
in the global context and finds it ... you have an element with this identifier.
An attempt to assign a number to an HTML element failed.
To solve this problem, simply declare messageLength
as a local variable:
var messageLength = messageVal.length;
source share