When writing code in Javascript to calculate some function, you may get the text [object HTMLInputElement] in the textbox instead of the proper value. This usually happens when you try to assign an object to the textbox, or the value is NaN (Not a Number object).


For example assigning the following will result in an error:

var newHeight = Number.NaN;
document.getElementById('newWidth').value = newHeight;

document.getElementById('newWidth').value = document.getElementById('newHTMLTextbox');

To fix this error ensure the variable you set to the textbox value is not an object but an actual value. For example:

document.getElementById('newWidth').value = document.getElementById('newHTMLTextbox').value.

* iOS Development * OS X * Product Review