Hi I have this PHP function:
function cookieNotification() {
if (!isset($_COOKIE["ntc-cookie-policy"]) or $_COOKIE["ntc-cookie-policy"] !== "1") {
// Set the cookie for 30 days from today
setcookie("ntc-cookie-policy", "1", time() + (86400 * 30), "/");
return "<div class=\"alert alert-info\" id=\"cookies\">
<div class=\"container\">
Council uses cookies to make this site simpler.
<a tabindex=\"-2\" href=\"/category/774/cookie-policy\"><span class=\"ButtonDefault\">Find out more about cookies</span></a>
<button onClick=\"\">Agree to cookies</button>
</div>
</div>";
}
}
Its purpose is to display an alert at the top of the screen about cookie usage, and I have been asked to add a button to the div to close the div when the user clicks on the button, but I don't know how to add this functionality to this function without writing it inline in the HTML being returned, and that is bad coding practice. Does anyone have a suggestion of how to get the button to do this? Cheers.