Please answer this I am getting frustrated 🥴

1Truth commented: Yes that's ok. I have set up for both cookie storage and local storage +0

Probably not, there are often ways around it, but more importantly, what are your requirements exactly?

I'm having the same issue. I want to show a custom message alert but I only want it to be shown once and when the visitor closes it with the x button then the cookies remember to not show it again.

This is the div (with the CSS):

<head>
<meta charset="UTF-8" />

<style>
.alert {
    padding: 20px;
    background-color: limegreen;
    color: white;
    font-size: 14px;
    line-height: 20px;
    height: auto;
    width:calc(100% - 50px);
}

.closebtn {
    margin-left: 15px;
    color: white;
    font-weight: bold;
    float: right;
    font-size: 20px;
    line-height: 18px;
    cursor: pointer;
    transition: 0.3s;
}

.closebtn:hover {
  color: black;
}
</style>
</head>

<body>
    <div class="container alert" id="box">
        <strong><em>No worries!</em>&nbsp;&nbsp;</strong>There will be updates displayed like this in the future.
        <a class="closebtn" id="btn">&times;</a>
    </div>    
</body>

I've been trying to get this to work but when I refresh the page it comes back anyways. I was told that JavaScript could be used to
store this information. Is there a way to make this work?

commented: For this we can set one value in local storage, is that okay? +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.