I am currently trying to access a control that is within a class.
HTML Code:
<span class="GeoPanelHeaderLeft">
<asp:Literal ID="LiteralHeaderText" runat="server" Text="New Survey Ticket"></asp:Literal>
 
 
 
<asp:Image ID = "errorImg" runat = "server" ImageUrl="..\Images\caution_red.gif" visible = "false"/>
<asp:Label ID = "literalerrortext2" runat="server" ClientIDMode= "Static"></asp:Label>
<asp:Label ID = "literalerrortext3" runat="server" ClientIDMode= "Static"></asp:Label>
<asp:Label ID = "LiteralErrorText" runat="server" ClientIDMode="Static" ></asp:Label>
JavaScript Code:
function setError(message) {
var test = window.document.getElementById("LiteralErrorText");
var test2 = window.document.getElementById("literalerrortext2");
var test3 = window.document.getElementById("literalerrortext3");
}
When I run my javascript function, the getElementById function returns objects for "literalerrortext2" and "literalerrortext3", however the object is null when it comes to "LiteralErrorText".
I am using master pages and not sure why this is happening. If anyone can help with this that would be awesome.
Thanks
Your Literal control is rendered literally as New Survey Ticket (no html unless you choose to put it there)... unlike your Label controls which are rendered as <span id=myid>Some text</span>.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With