Requirement is to set the label text from the tree view when user select any node. While debugging I am getting hospitalName correctly but it is not setting label text.
$("[id$=HospitalTreeViewDiv] span").click(function () {
var hospitalName = $(this)[0].outerText;
//this is also not working
// $("label[for='SelectedHospitalLiteral']").text(hospitalName);
$("[id$=SelectedHospitalLiteral]").val("abc");
});
This is aspx snippet
<div runat="server" id="HospitalTreeViewDiv">
<asp:TreeView ID="HospitalTreeView" runat="server" ExpandDepth="0">
</asp:TreeView>
</div>
<div class="alignBottom">
<p> <asp:Label ID="SelectedHospitalLiteral" runat="server" ></asp:Label></p>
</div>