0

Which is the more professional way. I like the first one better because you can pass in the class, id, name etc in one line.

1)

var button = "<button type='button' id='mybutton'></button>";
document.body.innerHTML+= button;

2)

var button = document.createElement("BUTTON");
document.body.appendChild(button);
Dark Night
  • 451
  • 1
  • 4
  • 7

0 Answers0