I am facing the challenge of removing a list item node if it matches a specific variable. For example
- If username is equal to User 1
- And if a node is also User 1
Then I want to remove this particular node. Unfortunately, I have not been able to assign IDs to the nodes. Here is the code that creates the child nodes.
$('#typing').append($('<li>').text(username + "is drawing..."));
And here is the part of the code where I am attempting to remove the target node.
if ($('<li>'.text == username + " is drawing...")){
console.log("its the same!");
$("<li>").remove();
prev_username = "";
}
});
Even though the code prints out "its the same," the node is not being removed. If anyone could provide assistance with this issue, I would greatly appreciate it. Thank you :)