tags:

views:

22

answers:

1

inside a normal JS function:

$('#friendsPop').jGrowl("testtmee");

Wont work, but:

$.jGrowl("testmeee");

Works just fine.. I have tested everything, and if i make a link outside a function, a normal a: link like this:

<a href="javascript:void(0);" onclick="$('#friendsPop').jGrowl('testme');">link</a>

It works fine too. But i wish to activate

$('#friendsPop').jGrowl("testtmee");

After an ajax successcall, and i need to have an ID.

What can i do about this?

A: 

I've used jGrowl from time to time, and I don't recall ever invoking it on a selected set of jQuery objects. The whole point of jGrowl is that it produces "unattached" messages at the window level -- a single global stream of messages, regardless of how they're invoked (or from where). Just like the Mac OS X Growl concept on which it's based.

Checking the jGrowl documentation, I also don't see any example where it's called like this:

$('.something').jGrowl('message'); 
// what would this even mean in jGrowl terms?

It's always like this:

$.jGrowl('message');

If it's working for you this way on occasion, it's fortuitous happenstance (I haven't looked at the jGrowl source code to figure out why, but I'm sure the answer's there).

Just call it $.jGrowl('Like This') and you're all set.

Ken Redler
Hi Ken. I need to specify a #id, so on my other ajax call on success I can do $('#something').jGrowl('close');.. Thats why I want it to work It's not always that way, if you e.g download jgrowl, in the jquery.html on examples dirr, you'll find custom containers $('#test1').jGrowl('message'); and so, and then before body close you'll find <div id="test1" class="bottom-left"></div> so it displays it at specific location (bottom left with that example).
Karem
Karem, can you set up an accessible page showing the problem?
Ken Redler