merhaba yapmak istediğim şey şuydu butona tıkladığımda tıkladığım buton kendini silecek ve diğer butonu getiricek
ama herşeyi doğru yaptığımı düşündüğüm halde nedense olmadı yardımcı olursanız iyi olur
Html Kodu:
`<form class="box ">
<h1 class="text-light" >Giriş</h1>
<div class="ornek" >
<input type="text" name="kullanıcıadı" id="kullanıcıadı" placeholder="Kullanıcı Adını Gir.">
<input type="password" name="password" id="sifre" placeholder="Şifreni Gir." >
<button type="submit" id="adam-1" class="btn btn-primary">Giriş</button>
</div>
<hr class="text-light">
<a href="#">Parolamı Unuttum.</a>
</form>`
Java Script Kodum:
`const newButtonReset = document.createElement("a");
const beforeButton = document.getElementById('adam-1');
const formBody = document.getElementsByClassName('box')[1];
newButtonReset.id = 'clear-todos';
newButtonReset.className = 'btn btn-danger';
newButtonReset.target = '_blank';
newButtonReset.appendChild(document.createTextNode('Yeni Link'));
beforeButton.onclick = function salako(){
beforeButton.revome();
formBody.appendChild(newButtonReset);
}
newButtonReset.onclick = function salako2(){
newButtonReset.remove();
formBody.appendChild(beforeButton);
}
console.log(newButtonReset);
console.log(formBody)
console.log(beforeButton);`