Re: [Proto-Scripty] Prototype's selector as well as "eq" in Jquery

94 views
Skip to first unread message

Walter Lee Davis

unread,
Sep 23, 2012, 6:19:17 PM9/23/12
to prototype-s...@googlegroups.com
Sure. if you start at the tr that holds the tds, you can use down() to do this. If you want the second td to have a certain width, you could do this:

$$('tr').each(function(elm){
elm.down('td', 2).setStyle('width:122px');
});

Walter

On Sep 23, 2012, at 12:59 PM, Евгений Шморгун wrote:

> I have to assign the different sizes to the td, and the width of them depends on the number's position of the tag in table.
>
> In Jquery I can write
>
> $$('td .yui-dt-liner div[id^=yui-gen]').eq(2).invoke("setStyle",{'width':'122px'});
> changing the argument in eq. is there analogue expression in prototype.js ?
>
> Thanks!
>
>
> --
> You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/rjXTGT4Eu94J.
> To post to this group, send email to prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.

Jason Westbrook

unread,
Sep 23, 2012, 11:28:43 PM9/23/12
to prototype-s...@googlegroups.com

You could probably also use

$$('td .yui-dt-liner div[id^=yui-gen]')[2].setStyle('width:122px');

for individual calls - but if you are going through multiple elements I would use each as Walter described

Jason Westbrook | T: 313-799-3770 | jwest...@gmail.com

Victor

unread,
Sep 24, 2012, 12:55:52 PM9/24/12
to prototype-s...@googlegroups.com
$("#table-id td:nth-child(2)")
will select 2nd cells in all rows of table with id "table-id"

Jason Westbrook

unread,
Sep 25, 2012, 12:50:48 PM9/25/12
to prototype-s...@googlegroups.com

nth-child doesnt work in Internet Explorer CSS - can Prototype correctly decode that in IE?

Jason Westbrook | T: 313-799-3770 | jwest...@gmail.com



On Mon, Sep 24, 2012 at 9:55 AM, Victor <vkhom...@gmail.com> wrote:
$("#table-id td:nth-child(2)")
will select 2nd cells in all rows of table with id "table-id"

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.

Walter Lee Davis

unread,
Sep 25, 2012, 9:30:26 PM9/25/12
to prototype-s...@googlegroups.com
Prototype does all the "CSS" stuff internally, and returns the correct element from the DOM. The browser doesn't have to do any heavy thinking.

Walter
Reply all
Reply to author
Forward
0 new messages