Use a tag that exists already like alt.
This is all I can suggest to you, all you have to do is read the
documentation. If you can't figure it out from all these hints then you
should think about taking up tennis. I don't even think you are trying.
<a id="foo" alt="Tennis is fun">Serve</a>
alert( $("foo").get("alt") ); // Prints out Tennis is fun
Also look here:
http://mootools.net/docs/more/Interface/Tips
http://mootools.net/docs/core/Element/Element#Element:get
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of soundseller
Sent: Wednesday, March 24, 2010 4:38 AM
To: MooTools Users
Subject: [Moo] Re: Tooltips / JSON Question
Hi,
thnx for your reply.
I tried to get a value from the hovered element(term):
<a href="#" class="tips" term="Germany">Germany</a>
I thought that according to the docs the above element gets passed as
"el" to the
...onShow: function(tip,el) {
var term = el.getAttribute('term');...
function and that I could retrieve it like this:
var term = el.getAttribute('term');
But I get an error:
Object [object Object] has no method 'getAttribute'
So I tried it like this:
var term = $(el).getAttribute('term');
Doesn't work either.
Will keep on trying.
Cheers
On Mar 24, 2:50 am, "Matthew Hazlett" <[email protected]> wrote:
> I don't know why kind of data you are trying to pass, but it's really easy
> to do (it's just calling a function). I'm not going to write it for you,
> you need to keep trying but you are on the right path.
>
> I'll give you a hint, pass two variables to get_content one is the tip
> object the other you need to figure out for yourself.
>
> You can also look at this (they may or may not be what you
want)http://mootools.net/docs/more/Interface/Tipshttp://mootools.net/docs/co
re/Element/Element#Element:gethttp://mootools.net/docs/core/Element/Element#
Element:storehttp://mootools.net/docs/core/Element/Element#Element:retrieve
>
>
>
> -----Original Message-----
> From: [email protected]
>
> [mailto:[email protected]] On Behalf Of soundseller
> Sent: Tuesday, March 23, 2010 3:45 PM
> To: MooTools Users
> Subject: [Moo] Re: Tooltips / JSON Question
>
> Hi Matthew,
> thanks for your patience.
>
> As I pointed out in my first post I want to pass a variable to the
> request function.
> This variable I want to get from the tooltip element(currently hovered
> element).
>
> It says in the docs(Yes, I did take a look at them :) "The default
> function for the show event, passes the tip element and the currently
> hovered element."
>
> Thats why I thought I could do sth like this:
>
> ...onShow: function(tip,el) {
> var term = el.getAttribute('term');...
> or this:
>
> ...onShow: function(tip,el) {
> var term = $(el).get('rel');...
>
> But that does not work.
> So I came up with all that crazy stuff.
> Any help is appreciated.
>
> On Mar 23, 11:29 pm, "Matthew Hazlett" <[email protected]> wrote:
> > Why are you using an each loop then, just update one not all :/
> > (RTFM might help too) :-)
>
> >http://mootools.net/docs/core
>
> > Instead of:
>
> > onShow: function(tip,el) {
> > tip.fade('in');
> > var ttips = $$('a.tips');
> > ttips.each(function(element,index) {
> > get_content(element.getAttribute('term'));
> > });
> > },
>
> > Just use:
>
> > onShow: function(tip,el) {
> > tip.fade('in');
> > get_content(tip);
> > },
>
> > -----Original Message-----
> > From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of soundseller
> > Sent: Tuesday, March 23, 2010 2:50 PM
> > To: MooTools Users
> > Subject: [Moo] Re: Tooltips / JSON Question
>
> > Hi Matthew,
> > thanks for your help.
> > The problem is, that if I have several links with tooltips attached,
> > everytime one of them
> > is hovered, the requests for all of them are fired.
>
> >http://mootools.net/shell/RVAeU/6/
>
> > Hmmm...
> > Any help is appreciated.
>
> > On Mar 23, 10:01 pm, "Matthew Hazlett" <[email protected]> wrote:
> > > Yes, your code makes no sense.
>
> > > When you hover and show the tool tip you are adding an event to reset
> the
> > > tool tip next time it is shown.
> > > You need to execute the updater on that iteration not the next one.
>
> > >http://mootools.net/shell/RVAeU/5/
>
> > > -----Original Message-----
> > > From: [email protected]
>
> > > [mailto:[email protected]] On Behalf Of soundseller
> > > Sent: Tuesday, March 23, 2010 12:55 PM
> > > To: MooTools Users
> > > Subject: [Moo] Re: Tooltips / JSON Question
>
> > > So I tried sth else, which is terrible code, but maybe you can see
> > > what I am
> > > trying to do and give me some support.
> > > It works only on the second hover.
>
> > >http://mootools.net/shell/RVAeU/4/
>
> > > Thnx
>
> > > To unsubscribe from this group, send email to
> > > mootools-users+unsubscribegooglegroups.com or reply to this email with
> the
> > > words "REMOVE ME" as the subject.
>
> > To unsubscribe from this group, send email to
> > mootools-users+unsubscribegooglegroups.com or reply to this email with
the
> > words "REMOVE ME" as the subject.
>
> To unsubscribe from this group, send email to
> mootools-users+unsubscribegooglegroups.com or reply to this email with the
> words "REMOVE ME" as the subject.
To unsubscribe from this group, send email to
mootools-users+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.
To unsubscribe from this group, send email to
mootools-users+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.