aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Get Set Text to Label or How to Get / Set Label Text in jQuery

Jun 12, 2013

Here I will explain how to get or set text to label in jQuery or JavaScript or Get / set text to label control in jQuery or JavaScript.


Get Set html label Value in jQuery

To get html label value in jQuery we need to write the code like as shown below

Get html label value

var txt = $('#lbltxt').html();

Set html label value

$('#lbltxt').html("your value");
To Get label Value

To get label value we need to write the code like as shown below

var txt = $('#<%=lbltxt.ClientID%>').html();
var txt = $("[id$='lbltxt']").html()
Set label Value

$('#<%= lbltxt.ClientID%>').html('Your Value')
$("[id$=' lbltxt']").html('Your Value')
For Example check this post

<script type="text/javascript" src=""></script>
<form id="form1" runat="server">
<asp:Label ID="lbltxt" runat="server" >Welcome to</asp:Label>
<label ID="lblhtml" runat="server" >Welcome to html label</label>
<input type="button" id="btnclick" value="click" />
<script type="text/javascript">
$(function() {
$("#btnclick").click(function() {
var txt = $('#<%=lbltxt.ClientID%>').html();
var txthtml = $('#lblhtml').html();
Same way we can get any controls in JQuery

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Anonymous said...

Hello Sir, This is abhinavsingh993, it is an Article that shows that you are a master of the

Unknown said...

given the best solution in every time

thank you suresh

Anonymous said...

if want add value to label which is in gridview how it will..?

Anonymous said...


Anonymous said...

Thanks it worked for me! @anjankant

Aarav Singh said...


Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.