asp.net - Set ASP Literal text with Javascript -
i have asp:literal on page (which cannot converted label or other control) need change text of via javascript. have following code works label. can help?
<script type="text/javascript"> function changetext() { document.getelementbyid('<%= test.clientid %>').innerhtml = 'new text'; } </script> <a href="#" onclick='changetext()'>change text</a> <asp:label id="test" runat="server" text="original text" />
thanks
update: cannot change literal code behind writes html/css information message e.g:
litmessage.text = "<div class='success'>information updated</div>"
<asp:literal>
controls don't create own html tag.
therefore, there no element can manipulate.
instead, can wrap <asp:literal>
in <div>
tag id.
Comments
Post a Comment