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 div
s by index, if that's what you're asking.
E.g.:
var thirdFooDiv = $("div.foo:eq(2)"); // Third one, first is 0
精彩评论