i have a @Html.Label("", new { id="txtStatus1" })
where txtstatus1 value is obtained using jquery as
$('#txtStatus1').val(TicketStatus);
but im not able to set this value to label .
This statement does not output anything as you have not specified a for value:
@Html.Label("", new { id="txtStatus1" })
If you change it to give it a value i.e.
@Html.Label("a", new { id="txtStatus1" })
It outputs this:
<label for="a" id="txtStatus1">a</label>
Sridhar R is correct you can use text to set it like this:
$('#txtStatus1').text('this')
You might need to add quotes and output around the argument if it is comming from your model i.e.
$('#txtStatus1').val('@Model.TicketStatus');
What is TicketStatus exactly?
Try this
Use .text() or .html()
Get html label value
var txt = $('#lbltxt').html();
Set html label value
$('#lbltxt').html("your value");
To get asp.net label value we need to write the code like as shown below
var txt = $('#<%=lbltxt.ClientID%>').html();
or
var txt = $("[id$='lbltxt']").html()
Set Asp.net label Value
$('#<%= lbltxt.ClientID%>').html('Your Value')
Or
$("[id$=' lbltxt']").html('Your Value')
.text()instead of.val()