Fetching value from label in jquery
Hi,
I am using aspx, js file.
I have a hidden div in which I have a label. The value of the label is added dynamically using aspx.cs code, and which is getting added. However I am not able to fetch the value in js file.
I have used the below code:
- // aspx
- <script type="text/javascript" src="/Scripts/testSearch.js">
- </script>
- <script type="text\javascript">
- var lblCatId = "<%=lblCategory.ClientID%>";
- </script>
- <div id="HiddenDiv" style="display: none;">
- <asp:Label ID="lblCategory" runat="server" Text=""></asp:Label>
- </div>
- // js file
- var selCategory = this.document.getElementById(lblCatId);
I am getting the error as "lblCatId" is undefined.
How to fetch the value ?
Thanks