I'm getting the error:
Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
When I try to insert one div after another using JavaScript.
function verificaHierarquia(e) {
var valor = $(e).val(),
valor2 = $(e).children(':selected').data("valor2");
if (valor2 == 1) {
var divSupervisor = document.createElement("div");
divSupervisor.id = "divSupervisor";
divSupervisor.className = "col-lg-6 mb-3";
var divAtual = document.getElementById("divSenha");
divAtual.insertBefore(divSupervisor, divSenha);
document.getElementById("divSupervisor").innerHTML =
'<label for="sup">Sup</label>\n'+
'<input type="text" name="sup" class="form-control">';
}
}