I'm trying to store some data in DOM Elements ($.cache)
on my plugin but I am facing some problem as mentioned below...
$(_buelement).data('yazi')
returns undefined
on metodlar.gizle
but it works on metodlar.goster
where I store the data.
In my plugin metodlar.goster initiates on onMounseIn and metodlar.gizle onMouseOut.
$.fn.balon = function( metod, girdi ) {
var _bu = this;
var metodlar = {
goster : function( ) {
return _bu.each(function ( ) {
var _buelement = $(this);
s.pozisyonAl(_buelement);
s.balon.fadeIn(300);
$.data(_buelement,{'balon' : s.balon,'yazi':'heyho'});
})
},
gizle : function( ) {
return _bu.each(function ( ) {
var _buelement = $(this);
$(_buelement).data('yazi');
})
}
}
});
Finally I ran some debug and found out the metodlar.gizle
is just works fine but data is still undefined
.
Here's Fiddle Link : http://jsfiddle.net/4FfWz/4/
Try changing the way you store the data in
goster
: