What is the correct way to hide an input text box? The following will appear: work in all browsers except Internet Explorer. I am testing IE8.
var field = document.getElementsByTagName("input")[0]; field.type = 'hidden';
For recording, the following does not work:
var field = document.getElementsByTagName("input")[0]; field.style.display = 'none';
Also this does not work:
var field = document.getElementsByTagName("input")[0]; field.setAttribute("type", "hidden");
source share