“remember” div's style on click (set a cookie) - jquery and jquery cookie plugin
问题 I have a group of divs with mouseenter, mouseleave and click events. var originalAttributes = $('.aaa').attr('style'); $('.aaa').mouseenter(function () { $(this).css('background', '#aaaaaa'); $(this).css('border', 'solid 1px red'); }); $('.aaa').mouseleave(function () { $(this).css('background','blue'); }); $('.aaa').click(function () { var $this = $(this); update_x1(this); $this.off('mouseenter mouseleave'); }); $('#save').click(function () { $.cookie({ expires: 30 }); }); $('#clear').click