[jQuery] syntax question
[jQuery] syntax question
hey mates,
I didn't find an answer to my week-old question so i'll rephrase to
simplify and focus on just the little bit of knowledge i need from you
guys:
say i want to create a function that performs some jquery methods on an element.
function doThis(){
$(this).text('i've been changed');
alert("my uniq="+this.uniq);
}
now, inside a plugin, i want to use that function as an option value
$('div.toBeSelected').myplugin({onIni:doThis});
here is my pseudo plugin:
$.fn.myplugin= function(options,callback){
return this.each(function(index){
$this = $(this);
uniq = 'iAmNumber_' + index;
$this.options.onIni();
});
}
So far, the function is called, but the alert returns "my uniq =
undefined" and the text() command is not performed. Why, oh why ?
--
Alexandre Plennevaux
LAb[au]
http://www.lab-au.com