Hope you enjoy Prototype!

The Prototype equivalent of jQuery's `$` function is `$$` (yes,

The Prototype equivalent of jQuery's `css` function is `setStyle`:

Prototype doesn't conflate the concepts of elements and lists of
elements like jQuery does, and so `setStyle` is for operating on a
single element, not a list of them. However, Prototype provides the
`invoke` function on arrays and other enumerable things to let you
call the same function on each item in the array:

So basically (assuming Prototype supports those CSS selectors, and I
think it does -- esp. if you use 1.7 and plug in the Sizzle engine,
which is what jQuery uses):
* * * *
$$("td:contains('Pendiente')").invoke("setStyle", "background",
$$("td:contains('Procesando')").invoke("setStyle", "background",
$$("td:contains('Completo')").invoke("setStyle", "background",
* * * *

If you're new to Prototype, it's __well worth__ your time to sit down
and read the API from beginning to end. It takes about 1-2 hours, and
will save you a lot more than that much time within the first couple
of weeks of use. Really 1-2 hours, I'm not joshing you. :-)

The "learn" page on the site is also useful, although frankly a bit
dated. There's also an unofficial wiki:

T.J. Crowder
Independent Software Consultant
tj / crowder software / com

On Aug 31, 2:39 pm, VEO creativos <veocreati...@gmail.com> wrote:
> Hi! I'm trying to assign a CSS style to a TR that contains the words
> "Pendiente", "Procesando" and "Completo".
> I've made this for jQuery, but I need to do it with prototype/
> scriptaculous and I'm a totally newbie.
> Thanks in advance for any help!
> This is the code I've made for jQuery:
> <script>
>   $("td:contains('Pendiente')").css("background", "#c00");
>   $("td:contains('Procesando')").css("background", "#0c0");
>   $("td:contains('Completo')").css("background", "#000");
> </script>
> Thanks!!

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to