jQuery.fn.testeee = function(_msg)
{
alert(_msg);
$(this[0]).overlay({
onBeforeLoad: function()
{
alert(_msg);
}
}).load();
};
$("#popup").testeee ('test');
$("#popup").testeee ('another_test');
This displays:
- test
- test
- another_test
- test
The alert() inside de anonymous function asigned to onBeforeLoad keeps showing "test". I try this:
jQuery.fn.testeee = function(_msg)
{
alert(_msg);
$(this[0]).overlay({
onBeforeLoad: static_func(_msg)
}).load();
};
function static_func(_msg)
{
alert(_msg);
}
$("#popup").testeee ('test');
$("#popup").testeee ('another_test');
And it works just fine. It displays:
- test
- test
- test
- test
Anybody knows why can be happening this?