Как установить cookie в таблице таблицы hide/show function? Поэтому, если пользователь нажмет "скрыть", он запомнит браузер, который по-прежнему скрывает функцию cookie, когда мы обновляем страницу.
Функция скрыть
function hideCol(columnClass){
$('table .'+columnClass).each(function(index) {
$(this).hide();
});
$('ul#hiddenCols').append('<li id="'+columnClass+'"><a href="javascript:;" onclick="showCol(\''+columnClass+'\');">Show '+columnClass+'</a></li>');
}
Функциональное шоу
function showCol(columnClass){
$('table .'+columnClass).each(function(index) {
$(this).show();
});
$('li#'+columnClass).remove();
}
Пожалуйста, помогите советом.
использование jquery cookie set cookie show/hide при выполнении функции процесса
function hideCol(columnClass){
$('table .'+columnClass).each(function(index) {
$(this).hide();
});
$('ul#hiddenCols').append('<li id="'+columnClass+'"><a href="javascript:;" onclick="showCol(\''+columnClass+'\');">Show '+columnClass+'</a></li>');
$.cookie("remember_state","hide"); //add it
}
function showCol(columnClass){
$('table .'+columnClass).each(function(index) {
$(this).show();
});
$('li#'+columnClass).remove();
$.cookie("remember_state","show"); //add it
}
Добавить функцию при готовности документа
$(document).ready(function(){
if($.cookie("remember_state")=="hide"){
//hide function
}else{
//show function
}
});