JSFiddle - React, Tailwind, and code Playground

by shivaay123

HTML

<html>

<head>
    <script type="text/javascript">

        function RdCookie() {
            var forallcookies = document.cookie;
            document.write("All Cookies : " + forallcookies);


            cookiesarr = forallcookies.split(';');

            // Now take key value pair out of this array
            for (var i = 0; i < cookiesarr.length; i++) {
                name = cookiesarr[i].split('=')[0];
                value = cookiesarr[i].split('=')[1];
                document.write("Key is : " + name + " and Value is : " + value);
            }
        }

    </script>
</head>

<body>
    <form name="myform" action="">
        <p> click the Button to View Output</p>
        <input type="button" value="Get all Cookie" onclick="RdCookie()" />
    </form>
</body>

</html>