Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ function gdprCookieNotice(config) {
// If request was coming from the modal, check for the settings
if(save) {
for (var i = 0; i < categories.length; i++) {
value[categories[i]] = document.getElementById(pluginPrefix+'-cookie_'+categories[i]).checked;
// Ensure the element exists before assigning the checked value
if (document.getElementById(pluginPrefix+'-cookie_'+categories[i])) {
value[categories[i]] = document.getElementById(pluginPrefix+'-cookie_'+categories[i]).checked;
}
}
}
gdprCookies.set(namespace, value, { expires: config.expiration, domain: config.domain });
Expand Down