And by the way: I tried to return jQ(this)... nothing changes.

On Feb 7, 1:18 am, ShurikAg <shuri...@gmail.com> wrote:
> Sorry, I have probably didn't enplane myself properly.
> I'm running it once, but when I'm trying to track "jQ
> (this).selector" (by alert), it alerts me twice in the same run: once
> with table and second is empty...
>
> On Feb 7, 1:11 am, jQuery Lover <ilovejqu...@gmail.com> wrote:
>
> > But you are saying first time you run it, it gives you 'table', the
> > second time you run it, it says it's not a table...
>
> > This means, the first time it is getting to the return statement... Or
> > did I get you wrong ?
>
> > ----
> > Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
>
> > On Sat, Feb 7, 2009 at 2:02 PM, ShurikAg <shuri...@gmail.com> wrote:
>
> > > But it does not even get to the return statement...
>
> > > On Feb 7, 12:47 am, jQuery Lover <ilovejqu...@gmail.com> wrote:
> > >> Maybe because you are return reference to the function not a jQuery 
> > >> object:
>
> > >>  > return this;
>
> > >> Read this 
> > >> post:http://jquery-howto.blogspot.com/2008/12/how-to-create-jquery-plugin-...
>
> > >> It explains why you need to return jQuery object.
>
> > >> On Sat, Feb 7, 2009 at 1:28 PM, ShurikAg <shuri...@gmail.com> wrote:
>
> > >> > Question related to the same plugin:
>
> > >> > Plugin code:
> > >> > jQ.fn.table = function(options, titles, data){
> > >> >                if(jQ(this).length == 0){
> > >> >                        //try to find at least one element
> > >> >                        $.log("Matching element "+jQ(this).selector+" 
> > >> > was not found!")
> > >> >                        return null;
> > >> >                }
> > >> >                //validate that this element is unique i=on hte page
> > >> >                if(jQ(this).length > 1){
> > >> >                        $.log("The element's selector must be unique on 
> > >> > the page!");
> > >> >                        return null;
> > >> >                }
> > >> >                //check if the elemment is a table
> > >> >                //alert(jQ(this).selector);
> > >> >                if(!jQ(this).is('table')){
> > >> >                        $.log("The element must be valid table 
> > >> > element!");
> > >> >                        return null;
> > >> >                }
> > >> >                /**
> > >> >                 * Save the selector for further
> > >> >                 */
> > >> >                Selector = jQ(this).selector;
>
> > >> >                //extend defaults
> > >> >                Options = jQ.extend({}, Defaults, options);
> > >> >                //init additional data
>
> > >> >                //init UI
> > >> >                jQ.fn.table.initUI();
>
> > >> >                return this;
> > >> >        };
>
> > >> > and I'm running it as:
> > >> > var $table = $('table');
> > >> > $table.table();
>
> > >> > and I'm always getting: "The element must be valid table element!"
>
> > >> > I've tried to trace what the selector is; and once it is "table" but
> > >> > the second time (in he same run) is null. Why there are two entries to
> > >> > this function anyways? I have only one table on the page.

Reply via email to