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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -