Label Value Set In Javascript Not Showing Server Side
I am setting value of asp:label in JavaScript but it is blank on server side on button click. what can be the issue?
Solution 1:
Using jQuery:
$("#<%= label1.ClientID%>").text("SetYourTextHere");
Using javascript:
document.getElementById("<%= label1.ClientID%>").innerHTML = "SetYourTextHere";
Solution 2:
I assume ( you should show what you've tried ) that you've used the value
attribute.
Use innerHTML
instead. A SPAN
does not have a value
attribute.
var lbl = document.getElementById("Label1");
lbl.innerHTML = "Hello World";
Post a Comment for "Label Value Set In Javascript Not Showing Server Side"