In the quoted example, the block function is passed as the event
handler. In your example, you just reference, but don't call it. Easy
to fix:

               $("#block").click(function()
                       {
                               $.tooltip.block();
                               alert ('woo-hoo');
                       });

Its a function that you can both pass around or call directly.

Jörn

On Thu, May 28, 2009 at 2:09 PM, fredriley <fred.ri...@gmail.com> wrote:
>
> Hi all
>
> I'm using the Tooltip plugin (http://bassistance.de/jquery-plugins/
> jquery-plugin-tooltip/) on a test page (http://www.nottingham.ac.uk/
> ~ntzfr/test/ajax/jquery/jquery_formtest1.html). It works fine as it
> stands. I want the user to be able to toggle tooltips on/off, and a
> demo on the plugin page uses the code:
>
> $("#block").click($.tooltip.block);
>
> to call the click event of the button id "block". That also works.
> What I then want is to display the tooltip status by changing the
> button text, which I thought I could do with a function. However, the
> following does nothing, though doesn't throw any errors:
>
>                $("#block").click(function()
>                        {
>                                $.tooltip.block;
>                                alert ('woo-hoo');
>                        });
>
> The alert box displays ok. So can anyone tell me why $.tooltip.block
> works on its own but not in a function?
>
> More generally, and here my jQuery newbie ignorance is showing, what
> is 'block' - a method or a property? What does the line
> $.tooltip.block actually mean? In this case $ isn't a selector but
> just shorthand for 'jQuery', so it looks like it says 'run the method
> jQuery.tooltip.block'.
>
> TIA for any tips/advice.
>
> Cheers
>
> Fred
>

Reply via email to