Inline function javascript to put cookies without JQuery - Nicolas BAPTISTA

Inline function javascript to put cookies without JQuery

If you are using basic pages such landing pages, is it possible that you still use basic languages such HTML/CSS/Javascript.
Here is an example of putting cookies and a log of the cookies with an inline function:

<a style="cursor: pointer;" onclick='(function() {
  document.cookie = "cookie=value"; 
  console.log( "cookies:", document.cookie ); 
})()'>
  Click Me 
</a>

Because we are not using href but onlick, I added the cursor style of pointer so the user can know he can click.

0 0 votes
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments