Check for null before making modifications.
@@ -158,6 +158,7 @@ function initDiscoveriesDataTable() {
default:
break;
}
+ if (document.querySelector("#shownDiscoveriesCounter") !== null) {
if (json.stateFilter != null) {
document.querySelector("#shownDiscoveriesCounter").innerHTML =
`<b><u>` + json.recordsTotal + postfix + `</u></b>`;
@@ -176,6 +177,7 @@ function initDiscoveriesDataTable() {
document.querySelector("#totalDiscoveriesCounter").style.display =
"";
}
+ }
return json.data.map((item) => {
// Map json data before sending it to datatable
const details = `
