Use children()
and each()
, you can optionally pass a selector to children
$('#mydiv').children('input').each(function () {
alert(this.value); // "this" is the current element in the loop
});
You could also just use the immediate child selector:
$('#mydiv > input').each(function () { /* ... */ });
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…