javascript - Localstorage keeps resetting -


i calling data mysql in rows, , each id placed in seperate div. once customer clicks on 1 of these div's (url) div should remove , place in "seen" tab. removing , adding class.

this works perfectly, if going example id 15 1 removing new 'seen'. first 1 resetting , moves 'new' again. how can make sure every time click on new url in row collects 1 in 'seen' tab?

php:

<?php while($row = mysql_fetch_array($result, mysql_assoc)) { // output data of each row $idselection = $row["entryid"];     echo "<div class='one-block-info' style='width: 33%; float: left; margin-top: 10px; margin-bottom: 10px; text-align: center; border: 1px solid black;'><div class='hide_div' style='font-size: 17px; color: #6a8f3b;'><br /><a class='tag-link new' style='color: rgb(106, 143, 59);' href='/offerte-formulier?id=". $idselection ."' target='_self'>id:<span class='empty_span'> " . $idselection . "</span></a></div>     <div class='hide_div'><br />keuken type:<span class='empty_span'> " . $row["stijlkeuken"] . "</span></div>     <div class='hide_div' style='padding-bottom: 10px;'><br />voornaam & achternaam:<span class='empty_span'> " . $row["firstname"] . " " . $row["lastname"] . "</span></div></div>"; } ?> 

javascript:

$(document).ready(function() {   $("a.tag-link.new").click(function() {     var pid = $(this);      $(pid).removeclass("new");     $(pid).addclass("active");     localstorage.setitem("selectedolditem", $(pid).text());   });    var selectedolditem = localstorage.getitem('selectedolditem');    if (selectedolditem !== null) {      $("a:contains('" + selectedolditem + "')").removeclass("new");     $("a:contains('" + selectedolditem + "')").addclass("active");   } }); 

so need make sure every row click should move 'seen' tab without 1 coming back. all


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -