how to create cookies in javascript



how to set cookie in javascript
how to get cookie value in javascript


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>

function setCookie(){
document.cookie='mycookie';
 alert('cookies Successfully set');
}

function getCookie(){
 var cv = document.cookie.split( ';');
 alert(cv[0]);  // get cookies value
}

</script>

 <input type="button" value="setCookie" onclick="setCookie();"  name="setcookie" />

 <input type="button" name="getcookie" value="getcookie" onclick="getCookie();"  />

Comments

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress