When I am using JavaScript, I encounter the following error during execution:
Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object
This is the code I am working with:
<asp:Content ID="content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript" type="text/javascript">
function ConfirmTransfer() {
if (confirm("System does not allow negative inventory, do you want to continue?") == true) {
document.getElementById("btnAlert").click();
}
}
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="uxContainer" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<asp:Button ID="uxTransfer" runat="server" Text="Transfer" OnClick="uxTransfer_Click" />
<asp:Button ID="btnAlert" runat="server" Text="GetDetails" OnClick="btnAlert_Click" />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="uxTransfer" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>