I have one label control as
<asp:Label runat="server" ID="label1" Visible="false" CssClass="label1css"></asp:Label>
So I am assigning some value to this label control. So how I will get that assigned value by using its class name in jQuery.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(Edit: from the comment asp:Label controls are rendered as span elements, so…)
HTML
labelspan elements don’t have a “value”. If you mean the content of thelabelspan element in the sense of<label>Content</label><span>Content</span>then try this:If you mean that you are going to assign a “value” attribute along the lines of
<label value="whatever"><span value="whatever">then try:Note that this will not work if more than one element has that same “label1css” class – the “.label1css” selector will get all matching elements and then the
.text()or.html()or.attr()method will get a value from the first matching element. From the name “label1css” it sounds like you are making the class name unique, which will work but really you should be using the id attribute for this purpose.