I'm trying to add the data from localStorage
to the cookie.
Here is the code:
let cookie_name = "points_trigger";
let cookie_data = localStorage.getItem('content');
document.cookie = `${cookie_name}=${cookie_data[0].outerHTML}`;
The data from localStorage
is an HTML
code.
This code creates a cookie but the content is undefined
. And also, I don't have any errors in the console.