I'm starting in javascript
and wanted to create html elements dynamically but when I load the page it goes blank and does not add the elements
code below:
function add (){
var texto = document.createTextNode("teste");
var p = document.createElement("p");
var ptexto = p.appendChild(texto);
var body = document.getElementsByTagName("body")[0];
body.appendChild(ptexto);
}