javascript - Invoking jQuery function without an element -


So, I use jQuery extensively and know the "right" way to lower me , But many times where I want to solve it in more normal way. I understand.

So, I can have a link like: . Now, I have a jquery function, which is all p. Clicks for a popup that takes the href-attribute and & lt; Div id = 'menu' & gt; & Lt; / Div & gt; item shows this case). It also handles the URL if it did not find any DOM items with that ID.

There is no problem here. But, there are times when I do not have the same control over co-operation, where I can make a selectable target. Either because this code is not made by me or because it is created through a series of functions, for which everyone will need a huge angle which I will not.

Therefore, from time to time, this code should be:

  & lt; A href = "javascript: popup ('menu')" & gt; Show Menu & lt; / A & gt;  

It will be in a situation where I can submit the label and HREF for only one link. No class, nothing.

The problem here is that the function popup () does not know which element has implemented it, and in most cases this is not a problem for me, because I just need to know it That the mouse cursor was signed

But in some cases, I am using any other device like qTip or something else so I still want to stop qTip (); When this JS function click on the link to run, but what do I attach to show it? I just can not run ($) QTip (); Because it means that $ (this) and "this" is undefined inside the function.

So how can I do this? Any ideas?

Do you have javascript method to be javascript: popup ('menu', this); ? I have used this method several times successfully.


Comments