There is ListBox1 with a listitem:
<asp:ListItem Value="No.1">No.1</asp:listitem>
And there is a label for a test
<asp:Label ID="lblLabel" runat="server" Text="Label1" ></asp:Label>
Now I am trying to test with Javascript (jQuery) whether the listitem No. 1 is selected when the listbox is left with tab or enter and that does not work. What could be wrong with this javascript (jQuery) code?
$("#ListBox1").focusout(function () {
if ($("#ListBox1").SelectedItem.Text === "No.1") {
// tried also if ($("#ListBox1").val() === "No.1") {
$("#lblLabel").Text = $("#ListBox1").SelectedItem.Text;
}
});