"The value of a man should be seen in what he gives and not in what he is able to receive"

― Albert Einstein ―

Writing values in cookie using jQuery


This is a very short post to use jQuery cookie plugin to store value in a cookie. This plugin can also be used to write, read, and delete cookies.  You can click on the link below to download the cookie plugin and reference the script file in your page.

Download Cookie Plugin here.
https://plugins.jquery.com/cookie/

Reference in your page.
<script src="script/jquery.cookie.js"></script>

The code below will get a value from the text box and store that value in a cookie.

<script>
$("document").ready(function (){
$("#LoginButton").on("click",function(){
$.cookie("UserName", $("#logintxtbox").val());
});
});
</script>