I would like to create a javascript function to remove an element from the list. The (unfinished) function is the following:
function removeUser(gData) {
var divUsers = document.getElementById('users');
console.log(divUsers);
var userId = gdata.Id(); //the element with this value should be removed from the list - e.g. if userId == 21367, 'Silvana' should be removed.
divUsers.remove(userId);
}
the divUsers looks like the following:
<ul id="users">
<li data-bind="text :FirstName, click:AddOwnerToUser.bind($data), value: Id" style="cursor:pointer" value="21367">Silvana</li>
<li data-bind="text :FirstName, click:AddOwnerToUser.bind($data), value: Id" style="cursor:pointer" value="23295">John</li>
</ul>
As a javascript newbie I would be very thankful if anyone could tell how to get the right element by its id and remove it.
Thanks!