JSFiddle - React, Tailwind, and code Playground

HTML

<div id="cookies_notification">Cookies notification!</div>
<input type="button" value="Remove" onclick="javascript:removeItem()"></input>
    <input type="button" value="Check" onclick="javascript:checkItem()"></input>

JavaScript

function removeItem() {
     $('#cookies_notification').remove();  
}

function checkItem() {
    if( $('#cookies_notification').length === 0 ) {
        alert('Item does not exist');
    } else {
        alert('Item exists');
    }
}