Thanks to Arun P Johny i achieve this code bellow but , there still a pb , Basicly, you click on a div then add class green background, so i'd like to keep the class after reload the page and i use jquery cookie plugin to achieve it, pb is div without checkboxes checked should not take the active class after page reloading, but unfortunatly its the case..
var $qsts = $(".quest").show();
var $anrs = $(".ans").hide();
$('.quest').click(function(){
var $ans = $(this).next().toggle(10);
$anrs.not($ans).hide();
});
$('.ans').change(function(){
var $ans = $(this).closest('.ans');
var $act = $ans.prev().toggleClass('question-active', $ans.find('input:checkbox:checked').length > 0)
if($act.hasClass('question-active')){
$.cookie('question-active', $act.get(0).className.match(/\b(question\d*)\b/)[1])
} else {
$.removeCookie('question-active');
}
});
var active = $.cookie('question-active');
if(active){
$qsts.filter('.' + active).addClass('question-active')
}
Here is the complete code : http://jsfiddle.net/arunpjohny/hZeyd/7/
thx for help