You have content you'd like to display or hide when a certain category of cookies is accepted or has not been accepted. For this you can use the following example:
First make sure you have your div has a class assigned to it. In the example below we're using Advertising category and a div called testdiv.
<script>
function callbackFnc(e) {
var consent = e.detail || CookieFirst.consent;
// no consent yet or advertising not accepted, return if (!consent || !consent.advertising) {
return;
}
var elements = document.querySelectorAll(".testdiv"); elements.forEach(function(el) {
el.style.display = 'block';
}); }
window.addEventListener("cf_consent", callbackFnc);
window.addEventListener("cf_init", callbackFnc);
</script>