Forum: Rails Spinoffs (closed, excessive spam) getting and writing atrr with prototype

Posted by Zell (Guest)
on 2008-07-05 06:53
(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
Posted by notsobad (Guest)
on 2008-07-05 07:43
(Received via mailing list)
Zell 写道:
>
>   
Get some element:
id='sub-div' => $('sub-div')
class='test' => $$('.test')[0]


get attribute => $('sub-div').readAttribute('attr')
set attribute => $('sub-div').setAttribute('attr', 'test')
Posted by T.J. Crowder (Guest)
on 2008-07-05 10:08
(Received via mailing list)
Hi Zell,

Welcome!  Hope you find Prototype useful.

The best thing you can do when learning Prototype, in my view, is
spend an hour or two reading the API docs. [1]  Prototype's API isn't
so big that you can't read the entire thing all the way through, and
doing that will save you a LOT of time in the long run.

[1] http://www.prototypejs.org/api

Hope this helps,
--
T.J. Crowder
tj / crowder software / com
This topic is locked and can not be replied to.