Referencing this straightforward conversation: Is there an "exists" function for jQuery?
The following code is seeing a zero but still evaluating to 'true' for the first case.
Here is the console result:
Found listView: 0 / 14
The code is in a dialog window...so perhaps it might see the element on the underlying page. But the zero in the log says otherwise...
Really frustrating edge case (or I've just lost my mind). Help appreciated.
if (('#listViewMenu').length) { // We are on taskpane list view
console.log('Found listView: ' + $('#listViewMenu').length + ' / ' + ('#tableViewMenu').length);
addList(); //hardcoded to list view only - auto load if there is an existing choice for Group
}
if (('#tableViewMenu').length) { // We are in dialog window table view
addTable();
}