0
I researched about and they said it was because HTML was being loaded before JS vice versa, the solution was to change the place of the calls of the scripts, I pasted in everything that is place and nothing
<div id="content">
<b id="bt_cad">cadastre se</b>
</div>
var content = document.getElementById('content');
bt_cad.click(function() {
log.css("display", "none");
cad.css("display", "block");
var c_form_cad = document.createElement('form');
c_form_cad.method="post";
c_form_cad.id="form_cad";
c_form_cad.autocomplete="off";
// erro no appendChild
document.getElementById(c_form_cad.id="form_cad").appendChild(content);
console.log(content);
console.log(c_form_cad);
});
It’s always good to reference a
id
using, ordocument.getElementById
ordocument.querySelector
, instead of doing sobt_cad.click
. I mean, it would bedocument.getElementById("bt_cad").click
ordocument.querySelector("#bt_cad").click
.– Sam