[Solved] How to grab the value of the span element using jQuery


Is “ctl00_lblTotalValue” the id you assigned to the span or is it a server-side control getting its ID auto-assigned by the environment?

For example, if I have this code in my .NET aspx page

<div id="pnlHeader" runat="server"></div>

it gets rendered in the html page as

<div id="ctl00_pnlHeader"></div>

If that is the case, I need to grab it in the jquery using this syntax

$("#<%= pnlHeader.ClientID%>").text()

If yours is a server-side control, you may need to grab the text using

spanValue = $("#<%= lblTotalValue.ClientID%>").text();

3

solved How to grab the value of the span element using jQuery