Thank you so much!! :)
It worked really good!
but I don't know if I did something wrong cause this styled every
single element on the page not only the TD that contains the target..
sorry annoying you... I'm a designer :-)
Is this right? (The TR was a typo, but thanks anyways because this is
a useful tip!)


On Aug 31, 11:43 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi again,
>
> I just caught the fact that you said you wanted to apply the style to
> the TR, but your selectors select TDs, not TRs. If that was just a
> typo, ignore this note. :-)
>
> If, however, you want to apply the style to the TRs containing those
> TDs, just put "tr > " at the beginning of each selector (e.g., "tr >
> td:contains..."). This isn't a jQuery/Prototype thing, just something
> I happened to notice...
>
> FWIW,
>
> -- T.J.
>
> On Aug 31, 3:39 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > Hi,
>
> > Hope you enjoy Prototype!
>
> > The Prototype equivalent of jQuery's `$` function is `$$` (yes,
> > really):http://api.prototypejs.org/language/dollardollar/
>
> > The Prototype equivalent of jQuery's `css` function is 
> > `setStyle`:http://api.prototypejs.org/dom/element/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:http://api.prototypejs.org/language/enumerable/prototype/invoke/
>
> > 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",
> > "#c00");
> > $$("td:contains('Procesando')").invoke("setStyle", "background",
> > "#0c0");
> > $$("td:contains('Completo')").invoke("setStyle", "background",
> > "#000");
> > * * * *
>
> > 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. 
> > :-)http://api.prototypejs.org
>
> > The "learn" page on the site is also useful, although frankly a bit
> > dated. There's also an unofficial 
> > wiki:http://prototypejs.org/learnhttp://proto-scripty.wikidot.com
>
> > HTH,
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / comwww.crowdersoftware.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 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to