Forum: Rails Spinoffs (closed, excessive spam) Can anyone help me with one function please

57a91067c99d11985aeb0f2c31884249?d=identicon&s=25 Zell (Guest)
on 2008-07-05 06:54
(Received via mailing list)
Hi i'm learning prototype and i need to know something...


Someone knows how to write and get the value of some atribute... i
mean like...jquery that uses $('#sub-div').atrr('alt','visible);

in prototype is there something like that?...

I hope you can help me and thanks :D
7b16d666cca4f44fd432ddc96908d090?d=identicon&s=25 wwarby (Guest)
on 2008-07-05 12:11
(Received via mailing list)
Zell,

I'm fairly new to Prototype myself but I believe the syntax you're
looking for is:

$('tag').readAttribute('title');

http://www.prototypejs.org/api/element/readAttribute

-William
F1fcf834ddad415f60d29c87cc10d4d4?d=identicon&s=25 kangax (Guest)
on 2008-07-05 19:14
(Received via mailing list)
That would be:
$('sub-div').writeAttribute({ alt: 'visible' });

-- kangax
6d980c09cc3fd1913deb45d8c4b8d1a3?d=identicon&s=25 Tobie Langel (tobie)
on 2008-07-05 19:26
(Received via mailing list)
or:

$('sub-div').writeAttribute('alt', 'visible');
57a91067c99d11985aeb0f2c31884249?d=identicon&s=25 Zell (Guest)
on 2008-07-06 06:14
(Received via mailing list)
Hey thanks!! it really helped me a lot!...


One mor thing, have anyone knows...how to tell lik...$$
('.class:visible').not($(this).find('div');


in prototype, i know that there is a function that is findElement();
but..i do not know if there's something like the .not(); that has
jquery... and i'm changin to prototype :D

thanks a lot
F1fcf834ddad415f60d29c87cc10d4d4?d=identicon&s=25 kangax (Guest)
on 2008-07-06 18:34
(Received via mailing list)
I'm not sure what jQuery's .find does, but you can use #reject to find
all "hidden" elements (since prototype.js only supports "standard"
selectors):
$$('.class').reject(Element.visible)
Note that since Element.visible only checks actual element's style, it
will skip any elements which have "hidden" parents.

-- kangax
F490e41cd5de1393a9f6958b70dae6ab?d=identicon&s=25 Frederick Polgardy (Guest)
on 2008-07-06 21:48
(Received via mailing list)
What initially threw me in jQuery was filter() vs. find().  filter()
gets
the *subset* of elements that match some selector, where find() gets the
*
children* of elements that match some selector.

-Fred

On Sun, Jul 6, 2008 at 11:33 AM, kangax <kangax@gmail.com> wrote:

>
> I'm not sure what jQuery's .find does, but you can use #reject to find
> all "hidden" elements (since prototype.js only supports "standard"
> selectors):
> $$('.class').reject(Element.visible)
> Note that since Element.visible only checks actual element's style, it
> will skip any elements which have "hidden" parents.
>
> -- kangax



--
Science answers questions; philosophy questions answers.
This topic is locked and can not be replied to.