When I run the following JS I always get the confirm box popping up despite the list visibly having items.
<asp:ListBox ID="list" runat="server" Width="135px" Rows="8" />
function CheckListEmpty() {
if ($("#list").length == 0) {
if (confirm("Are you sure?")) {
//they clicked OK so save and close
return true;
}
else {
//do nothing they hit cancel.
return false;
}
}
else
return true;
}
What am I doing wrong?