Solved

JQuery -  object doesn't support property or method cookie

Posted on 2012-03-29
4
4,445 Views
Last Modified: 2012-08-14
Use JQuery tabs, and store the selected tab to the cookie, but it returns error saying that "
 Object doesn't support property or method 'cookie'

Use the following js files

<script src="/javascripts/jquery-latest.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="/javascripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery-ui-1.8.18.custom.min.js"></script>

Below is my scripts

<script type="text/javascript">
$(function(){

      $('.selector').tabs({cookie: { expires:30 }});

      // Tabs
      $('#tabs').tabs();
      //hover states on the static widgets

      $(document).ready(function() {
         $('#tabs').tabs('select', $.cookie("tabNumber"));
         $('#tabs').click(function() {
           $.cookie("tabNumber", $("tabs").tabs('option', 'selected'));
         });
      });

      $('#dialog_link, ul#icons li').hover(
            function() { $(this).addClass('ui-state-hover'); },
            function() { $(this).removeClass('ui-state-hover'); }
      );

      $('#tabs').tabs({
          load: function(event, ui) {
              $(ui.panel).delegate('a', 'click', function(event) {
                  $(ui.panel).load(this.href);
                  event.preventDefault();
              });
          },
      });

});
</script>

===================================================
Do a google search for solution for a hour, still can't resolve this issue. can anyone here help me?
0
Comment
Question by:unistudent
4 Comments
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37780793
It seem you did not include jquery coockie plug-in

Download and include it in your script

like

<script src="/javascripts/jquery.cookie.js"></script>

https://github.com/carhartl/jquery-cookie
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 37780801
you need to include jquery cookie plug-in
https://github.com/carhartl/jquery-cookie
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37781545
And remove this line :
<script src="/javascripts/jquery-latest.pack.js" type="text/javascript"></script>

Open in new window

OR this one :
<script type="text/javascript" src="/javascripts/jquery-1.7.1.min.js"></script>

Open in new window


currently you've two jQuery plugins in your page
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question