how to use one plugin for many elements
hi , i have a plugin like below
$.fn.tooltipe = function(opt){
settings = $.extend({name:"just name"},opt);
$(this).mousemove(function(){
console.log(settings.name);
});
}
$("btn1").tooltipe({name:"clickme"});
$("btn2").tooltipe({name:"clickme2"});
when i hover over on both those button the name clickme2 w'll appear in console for both of them i mean if i hover on btn1 i see clickme2 and if i hover on btn2 i see clickme2 again , why this is happening and there are sth else
when i use
$.fn.tooltipe = function(text){
$(this).mousemove(function(){
console.log(text);
});
}
the above plugin w'll works fine and if i hover on each of the those button they'll give me their name in seperate
if i hover on btn1 i see clickme in console and if i hoverd on btn2 i see clickme2 in console
but i dont know why the first plugin wont work fine .