Question

I have a big problem, jQuery cookies not working in all browsers.. And I'm using latest jQuery library version 1.4.4

Please help me

Edit:

var mid = $.cookie('mid');
if (mid == '1') {
    $('#something').css('background', '#d3d3d3');
}
Was it helpful?

Solution

Some ideas:

  1. Try checking the error console for errors (on Firefox, Ctrl+Shift+J, or F12 for firebug).
  2. Make sure you the cookie plugin is included in the page properly.

OTHER TIPS

I had the Same Problem and the solution was too simple, I was loading jquery.cookie.js before I was loading jquery. As soon as I rearranged the script inclusions the problem went away.

script type="text/javascript" SRC="javascript/jquery-1.5.1.min.js"></script>
script type="text/javascript" SRC="javascript/jquery-ui-1.8.10.custom.min.js"></script>
script type="text/javascript" SRC="javascript/jquery.cookie.js"></script>
script>

This might sound like a stupid question, but are you sure you have the jQuery cookie plugin included in your markup file? If it's this one, it doesn't come out of the box with jQuery, you have to include it yourself.

First you need to confirm the html page is in server like localhost or hosted in any server. If you try to implement in index.html in general local directory in your pc, it will not work. Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top