I have a div and inside this div, a ContentPlaceHolder, and inside the holder a Linkbutton.
I am trying to remove the link button dynamically but I am getting this error:
Error: DOM Exception: NOT_FOUND_ERR (8).
Here is my code:
<div id="leftcol" style="z-index: 0">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
<asp:LinkButton CssClass="childLI" ID="tblRSManswers" runat="server" Text="RS Manswers" OnClick="ChildLink_Click" >
Javascript code:
var child = document.getElementById("tblRSManswers"));
alert(child);
var parent = document.getElementById("ContentPlaceHolder2"));
alert(parent);
parent.removeChild(child);
P.S: The alerts are not NULL.
removeChildexpects an immediate parent. Your pasted HTML seems to be only excerpts of the most relevant code, so even though it looks like it in your code, I’m not sure this is the case in your real application?Try