<!DOCTYPE html> <html> <body> <input type="checkbox" value="foo"> <script> var i = document.getElementsByTagName("input")[0]; i.type = "text"; i.value = "abcdef"; </script> </body> </html>