javascript - Store link class for future pages -


i have index page, 4 links on it. let's give them numerical values of 1, 2, 3 & 4.

whatever link click, i'd store class of link , echo value on future pages, until return index page , start again.

so if click link 2, 2 displayed on page, if go page 2 page 4, 2 continue displayed.

sorry lack of code or logic, brain fried.

for cases suggest use localstorage. it works on major browsers. e.g.:

$('.mylinks').on("click", function() {     localstorage.setitem("current-link", this.classname); // can check 'current-link' @ dev tools(f12) -> resources (chrome) }); 

the logic is, when link clicked, store class. available through pages. if want data store on current session, can use sessionstorage well.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -