$.data() works on pure DOM elements so you would have to do:

$.fn.myPlugin = function() {
  return this.each(function() {
      console.log($.data($(this).parent().parent()[0]));
      $(this).blur(function(e) {
          $.myPlugin.test($(this).parent().parent()[0]);
      });
  }
};

OR, with jQuery 1.2.3, do:

$.myPlugin = {
  test: function(target) {
      console.log(target.data());
  }
}

--John

On Sun, Mar 9, 2008 at 4:04 PM, Julie A <[EMAIL PROTECTED]> wrote:
>
>  How is jQuery.data() calculating the id?
>
>  I'm using code simar to:
>
>  $.fn.myPlugin = function() {
>    return this.each(function() {
>        console.log($.data($(this).parent().parent()));
>        $(this).blur(function(e) {
>            $.myPlugin.test($(this).parent().parent());
>        });
>    }
>  };
>
>  $.myPlugin = {
>    test: function(target) {
>        console.log($.data(target));
>    }
>  }
>
>  And my console logs output different numbers for the same element
>  (I've triple checked in Firebug). Is this the GC kicking in or what am
>  I not seeing?
>
>  I'm using this to store options for my plugin based on instance. If
>  I'm totally misusing this, any ideas on what I could do to achieve the
>  same effect?
>
>  Thanks in anticipation!
>

Reply via email to