The structure of the news is about as follows.
<div id="1"> ..... <a href="">кнопка</a> </div> <div id="2"> ..... <a href="">кнопка</a> </div> <div id="3"> ..... <a href="">кнопка</a> </div> How to add the class views to the div but only to the one in which the button is located and write it in the cookie here with this plugin https://github.com/carhartl/jquery-cookie
Here is something that has been made, but only the last clicked link `var cookieName = 'level'; var cookieOptions = {expires: 7, path: '/'};
$("#" + $.cookie(cookieName)).addClass("views"); $(".play").click(function(e){ e.preventDefault(); $.cookie(cookieName, $(this).attr("id"), cookieOptions); $("#" + $.cookie(cookieName)).addClass("views"); });` Links such <div class="shortplaypanel"><a id="Player{news-id}" href="">кнопка</a></div> and so on, only {news-id} changes
How to make all links with different id memorized, and not just the last clicked?
<a id="1" href="">кнопка</a>and<a id="2" href="">кнопка</a>by clicking to change the style of this link . So that after reloading the page, it remains for the user in the same state - steep