How do you retain the changed name of a link after a reload or refresh of that page?
$("a").click(function(){
$(this).text("Hello");
});
At the moment, if I hit refresh, the link's name will be back to original. In this case, I want to retain the value hello.
Help please.
. you can use jquery cookie pluing or you can use local storage plugin . for better understand difference between local storage and cookie you can refer this link
$("a").click(function(){
$(this).text("Hello");
$.cookie('text', "Hello");
});
/// code to get value when page load
$(document).ready(function(){
if($.cookie('text')){
$("element").text($.cookie('text'));
}
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.