开发者

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜