Solved

JQuery -  object doesn't support property or method cookie

Posted on 2012-03-29
4
4,137 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
Comment Utility
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
Comment Utility
you need to include jquery cookie plug-in
https://github.com/carhartl/jquery-cookie
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now