javascript - view icon(ex. eye icon ) on click of a link -
i want display eye icon after click on link. eg. have job listings , saw 1 post , clicked view details after should show icon tells me visited post , have store viewed posts in collection , retrieve. have tried show eye icon on click when refresh page it's not displaying. how fix it? can me out that. in advance.
here sample html trying
<div id="search"><h2><a href="#">clinical psychologist </a><span class="job-type part-time">part time</span></h2></div> <div id="eyeicon"> <span class="glyphicon glyphicon-eye-open"></span> </div>
and js
$(document).ready(function(){ $("#eyeicon").hide(); $("#search").click(function(){ $("#eyeicon").show(); }); });
your question has not simple jquery answer. javascript variables or changes javascript in dom (html) not stored. need way store items can done multiple ways
- in cookie
- in localstorage
- in database on server (i prefer this) in case need ajax
and need receive these values on load of website , show icon on each item stored in cookie/localstorage/database (your choice)
i hope :)
Comments
Post a Comment