Save selected tab on a cookie?

Save selected tab on a cookie?

hi all ! I need to know how to do this, Im reading the documentation and I know I have to get the cookie plugin and set up the variable:
 
  1. <script>
      $(document).ready(function() {
        $("#tabs").tabs();
     $( ".selector" ).tabs({ cookie: { expires: 30 } });
      });
      </script>




    But where do I put where to save the cookie? In the documentation I see:

    //getter
    var deselectable = $( ".selector" ).tabs( "option", "deselectable" );
    //setter
    $( ".selector" ).tabs( "option", "deselectable", true );




      But I dont know where to use it,
      Any help is appreciated.