开发者

Select a div within a while of divs

How to select a div among a set of divs have the same class? these divs retrieved f开发者_运维知识库rom a database and shown using a mysql_fetch_array while. Coz I wanna use/edit information included within each one of these divs.

Any way of act is welcome: jquery, javascript, ..

Regards!


You can use jQuery's :eq selector and/or .eq() function (and their derivatives :first/.first(), :last/.last(), ...) to select a specific div amongst a set of divs by index, if that's what you're asking.

E.g.:

var thirdFooDiv = $("div.foo:eq(2)"); // Third one, first is 0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜