How do i get value of label
<div id="abc">
<table id="qtytable">
<tr>
<td>
开发者_高级运维 <asp:Label ID="QTY" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
How do I get value of label?
$("#abc).find("#qtytable label:first");
Returns length 0. What is an alernative?
$('#<% QTY.ClientID %>').text();
Remember ASP.NET renders controls with different client names than server ID names.
$('#<%=QTY.ClientID%>').html()
will give the value.
$('<%= QTY.ClientID %>').html();
or even using javascript :
document.getElementById('<%= QTY.ClientID %>').value;
$('#<%=QTY.ClientID%>').text()
.text() should get you the value
api here:
http://api.jquery.com/text/
精彩评论