I am setting value of asp:label in JavaScript but it is blank on server side on button click.
what can be the issue?
I am setting value of asp:label in JavaScript but it is blank on server side on button click.
what can be the issue?
Using jQuery:
$("#<%= label1.ClientID%>").text("SetYourTextHere");
Using javascript:
document.getElementById("<%= label1.ClientID%>").innerHTML = "SetYourTextHere";
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";