AppendChild() is not a function javascript
Your div variable is a string, not a DOM element object: Strings don’t have an appendChild method. Instead of creating a raw HTML string, create the div as a DOM element and append a text node, then append the input element: