javascript - Don't change the color of table row once visited -
i want application run in same way gmail
does. once visit mail color changes permanently when reload page remains same
'here fiddle'
http://jsfiddle.net/kzsjr/#&togetherjs=opoxyfna4o
when click on 'po' button row color must change permanently in gmail thank help
you have use localstorage
, this:
$("#po").click(function(){ localstorage.setitem("visited", true); $("#po").css("color", "black"); // visited });
now on page load,
$(window).load(function(){ if(localstorage.getitem("visited")) { $("#po").css("color", "black"); // visited } else { $("#po").css("color", "green"); // not visited } });
alternatively, can use cookies (but usage becomes bit lengthy imo).
p.s. note localstorage can modified users, , not used storing sensitive user data. further reading.
Comments
Post a Comment