JSFiddle - React, Tailwind, and code Playground
by Lynda333
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.0/jquery.cookie.min.js"></script>
<div class="cookie-test"> </div>
JavaScript
$(function() {
//Create Session Cookie
$.cookie('test-for-cookie', '1');
//Test for Session Cookie
var yesCookie = $.cookie('test-for-cookie');
if (yesCookie == 1) { //If cookies is there run function
$( ".cookie-test" ).html( "<p>Cookies are Enabled! :) </p>" );
} else{ //If No Session Cookie Run This Function
$( ".cookie-test" ).html( "<p>Cookies are Disabled! :( </p>" );
}
});