Get cookie value using cookie name Javascript / jQuery
Use cookie name to get cookie value, pass cookie name in function it will return cookie value.
getCookie(cookieName)
// read cookie data function getCookie(cookiename) { // Get name followed by anything except a semicolon var cookiestring=RegExp(""+cookiename+"[^;]+").exec(document.cookie); // Return everything after the equal sign, or an empty string if the cookie name not found return unescape(!!cookiestring ? cookiestring.toString().replace(/^[^=]+./,"") : ""); }
Read: Create, Read and Delete cookie Javascript / jQuery
Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes0
No0