@hadis what about this:
document.getElementById(id).remove();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to remove one of items using id this is my code:
function AddToDo() {
let item = document.getElementById("add").value;
const id = 'item-' + Math.random().toString().replace('.', '')
const htm = `<li id='${id}'><div class="form-check"><label class="form-check-label"><input class="checkbox" type="checkbox"><p class="todo">' ${item} '</p><i class="input-helper"></i></label><a class="clear" href="" id="clear" onclick="remove('${id}')" >clear</a><a class="edit" href="" id="edit" >edit</a></div></li>`;
document.getElementById("todos").innerHTML += htm
}
function remove(id) {
let dele = document.removeChild(id);
}
but it's not working,what is the problem?
Please or to participate in this conversation.