Ok, I have looked at other code and still get get it to work

(function($)
{
$.fn.extend(
        {
        paginator: function(options)
                {
                        $.extend(this.options, options);

                        //this.go_to_page(this.options.current_page);
                }
        });
})(jQuery);

$(document).ready(function()
{
        var paginator = $.paginator({
                                                                'url': 
'/lib/ajax/trip_search/load_users.php',
                                                                'replace_id': 
'user_paginator',
                                                                'total_items': 
'<?php echo $total_items; ?>',
                                                                
'items_per_page': '10',
                                                                'total_pages': 
'<?php echo $total_pages; ?>'
                                                                });
});

But this code tells me there is an error that paginator is not a function,
what is wrong here?


Eridius wrote:
> 
> I can't seem to remember since it has been ahile since I want to do this,
> how do i make a jQuery plug that i can access like
> 
> var paginator = $.paginator({/*data*/});
> paginator.next_page();
> //etc...
> 
> currently my code is like this:
> 
> (function($)
> {
>       initialize= function(options)
>       {
>               $.extend(this.options, options);
> 
> 
>       };
> 
>       options =
>       {
>               'url': null,
>               'replace_id': null,
>               'load_file': null,
>               'total_items': 0,
>               'items_per_page': 10,
>               'total_pages': 0,
>               'current_page': 0,
>               'new_page': 0;
>       };
> }(jQuery);
> 
> I also need to make sure that the initialize function is called when i
> create the object.  Thanks.
> 

-- 
View this message in context: 
http://www.nabble.com/Making-a-jQuery-plugin-tf4958186s27240.html#a14201039
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to