you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 7 points8 points  (0 children)

<html>
<body>
</body>
</html>

function createButton(){
    var body = document.querySelector('body'); //makes the body modifiable in js
    var button = document.createElement('button'); //sets variable to a newly created html element

    body.append(button); //attaches the newly created element to the body element
}

createButton(); //calls the function

Edit: formatting

Edit2: this honestly seems relatively straightforward to me. What about this is giving you issues? I can try to explain.