I want to make a confirmation box in case of yes, the information will be deleted and if not, nothing is deleted and the information is saved; I've dealt with e.prevent default()
, but I can not make it work.
function removerinput(event){
input = document.getElementById("input");
caja.removeChild(input);
if (caja.childElementCount == 0) {
var alerta = ("Estas a punto de eliminar tu ultimo valor ¿Estas seguro?");
if (confirm(alerta)){
alert("Eliminaste todos tus valores");
}
else{
event.preventDefault();
}
}
}