In this line: if (inputType[i].nodeValue = "text") { You're setting every node value to 'text'. The line should read: if (inputType[i].nodeValue == "text") { (note the extra '=') :) Paul