Article
Saving an object to a cookie
https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js
Copy to clipboard
A more descriptive data structure can be used to store information about a user.
An object can be used to enhance ways to retrieve specific user information that has been stored in our user cookie: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/cookies/ex6.js?actionable=true In this example the name, age, rating and gender of a user into the cookie named user
<script>
$(document).ready(function(){
XT1
});
</script>
$(document).ready(function(){
XT1
});
</script>
Copy to clipboard
Live demo
<script>
$(document).ready(function() {
XT1
});
</script>
$(document).ready(function() {
XT1
});
</script>
Copy to clipboard
Press the Run Demo button to execute the scripts above.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.