Mam taki kod do JS

  1. jQuery.cookie = function(name, value, options) {
  2.    if (typeof value != 'undefined') { // name and value given, set cookie
  3.        options = options || {};
  4.        if (value === null) {
  5.            value = '';
  6.            options.expires = -1;
  7.        }
  8.        var expires = '';
  9.        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
  10.            var date;
  11.            if (typeof options.expires == 'number') {
  12.                date = new Date();
  13.                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
  14.            } else {
  15.                date = options.expires;
  16.            }
  17.            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
  18.        }
  19.        // CAUTION: Needed to parenthesize options.path and options.domain
  20.        // in the following expressions, otherwise they evaluate to undefined
  21.        // in the packed version for some reason...
  22.        var path = options.path ? '; path=' + (options.path) : '';
  23.        var domain = options.domain ? '; domain=' + (options.domain) : '';
  24.        var secure = options.secure ? '; secure' : '';
  25.        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
  26.    } else { // only name given, get cookie
  27.        var cookieValue = null;
  28.        if (document.cookie && document.cookie != '') {
  29.            var cookies = document.cookie.split(';');
  30.            for (var i = 0; i < cookies.length; i++) {
  31.                var cookie = jQuery.trim(cookies[i]);
  32.                // Does this cookie string begin with the name we want?
  33.                if (cookie.substring(0, name.length + 1) == (name + '=')) {
  34.                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
  35.                    break;
  36.                }
  37.            }
  38.        }
  39.        return cookieValue;
  40.    }
  41. };
  42. /* Here's the actual code. */
  43. if($.cookie('remember_select') != null) {
  44.    $('.select_class option[value="' + $.cookie('remember_select') + '"]').attr('selected', 'selected');
  45. }
  46. $('.select_class').change(function() {
  47.    $.cookie('remember_select', $('.select_class option:selected').val(), { expires: 90, path: '/'});
  48. });
  49. </script>



I teraz nie mam pojęcia jak miałoby to zadziałać na na <li> bo działa tylko na <select>

Kod działający z select
  1. <select class="select_class">
  2.    <option value="1">Row 1</option>
  3.    <option value="2">Row 2</option>
  4.    <option value="3">Row 3</option>



Jak to zrobić pod <li>
Strona www: http://silverhax.pl/index.php po prawej w menu mam jest lista rozwijana "Superliga"