add placeholder javascript code example Example: javascript add placeholder to input document.getElementById("myText").placeholder = "Type name here..";